2017-02-16 15:43:29 -08:00
|
|
|
import {browser, by, element, ExpectedConditions} from 'protractor';
|
2017-06-10 01:09:08 +02:00
|
|
|
import {screenshot} from '../screenshot';
|
2017-01-12 13:24:51 -08:00
|
|
|
|
2016-12-19 20:17:23 +02:00
|
|
|
|
2017-01-18 23:13:48 +01:00
|
|
|
describe('button', () => {
|
|
|
|
|
describe('disabling behavior', () => {
|
|
|
|
|
beforeEach(() => browser.get('/button'));
|
2017-01-12 13:24:51 -08:00
|
|
|
|
2017-06-01 17:49:20 +02:00
|
|
|
it('should prevent click handlers from executing when disabled', async () => {
|
2016-06-24 11:34:49 -07:00
|
|
|
element(by.id('test-button')).click();
|
|
|
|
|
expect(element(by.id('click-counter')).getText()).toEqual('1');
|
2017-06-01 17:49:20 +02:00
|
|
|
|
|
|
|
|
await browser.wait(ExpectedConditions.not(
|
|
|
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
|
|
|
|
|
screenshot('clicked once');
|
2016-04-04 11:32:29 -07:00
|
|
|
|
2016-06-24 11:34:49 -07:00
|
|
|
element(by.id('disable-toggle')).click();
|
|
|
|
|
element(by.id('test-button')).click();
|
|
|
|
|
expect(element(by.id('click-counter')).getText()).toEqual('1');
|
2017-06-01 17:49:20 +02:00
|
|
|
|
|
|
|
|
await browser.wait(ExpectedConditions.not(
|
|
|
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
|
|
|
|
|
screenshot('click disabled');
|
2016-04-04 11:32:29 -07:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|