rniwa@webkit.org | 9c6a640 | 2017-01-19 22:58:46 +0000 | [diff] [blame] | 1 | |
| 2 | describe('CloseButton', () => { |
rniwa@webkit.org | 3ac7cd5 | 2018-06-07 18:25:35 +0000 | [diff] [blame] | 3 | const scripts = ['instrumentation.js', '../shared/common-component-base.js', 'components/base.js', 'components/button-base.js', 'components/close-button.js']; |
rniwa@webkit.org | 9c6a640 | 2017-01-19 22:58:46 +0000 | [diff] [blame] | 4 | |
| 5 | it('must dispatch "activate" action when the anchor is clicked', () => { |
| 6 | const context = new BrowsingContext(); |
| 7 | return context.importScripts(scripts, 'CloseButton').then((CloseButton) => { |
| 8 | const closeButton = new CloseButton; |
| 9 | context.document.body.appendChild(closeButton.element()); |
| 10 | |
| 11 | closeButton.content().querySelector('a').click(); |
| 12 | |
| 13 | let activateCount = 0; |
| 14 | closeButton.listenToAction('activate', () => { |
| 15 | activateCount++; |
| 16 | }); |
rniwa@webkit.org | d815331 | 2017-02-17 05:36:05 +0000 | [diff] [blame] | 17 | expect(activateCount).to.be(0); |
rniwa@webkit.org | 9c6a640 | 2017-01-19 22:58:46 +0000 | [diff] [blame] | 18 | closeButton.content().querySelector('a').click(); |
rniwa@webkit.org | d815331 | 2017-02-17 05:36:05 +0000 | [diff] [blame] | 19 | expect(activateCount).to.be(1); |
rniwa@webkit.org | 9c6a640 | 2017-01-19 22:58:46 +0000 | [diff] [blame] | 20 | closeButton.content().querySelector('a').click(); |
rniwa@webkit.org | d815331 | 2017-02-17 05:36:05 +0000 | [diff] [blame] | 21 | expect(activateCount).to.be(2); |
rniwa@webkit.org | 9c6a640 | 2017-01-19 22:58:46 +0000 | [diff] [blame] | 22 | }); |
| 23 | }); |
| 24 | |
| 25 | }); |