* Prepare the render data, create the node and add handlers * @return {!Promise}
()
| 173 | * @return {!Promise} |
| 174 | */ |
| 175 | render() { |
| 176 | this.description = encodeURIComponent(this.description); |
| 177 | this.media = encodeURIComponent(this.element.getAttribute('data-media')); |
| 178 | this.url = encodeURIComponent(this.element.getAttribute('data-url')); |
| 179 | |
| 180 | const query = [ |
| 181 | 'amp=1', |
| 182 | `guid=${Util.guid}`, |
| 183 | `url=${this.url}`, |
| 184 | `media=${this.media}`, |
| 185 | `description=${this.description}`, |
| 186 | ].join('&'); |
| 187 | this.href = `https://www.pinterest.com/pin/create/button/?${query}`; |
| 188 | |
| 189 | let promise; |
| 190 | if (this.count === 'above' || this.count === 'beside') { |
| 191 | promise = this.fetchCount(); |
| 192 | } else { |
| 193 | promise = Promise.resolve(); |
| 194 | } |
| 195 | return promise.then(this.renderTemplate.bind(this)); |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Determine the height of the contents to allow resizing after first layout. |
nothing calls this directly
no test coverage detected