2017-02-16 15:43:29 -08:00
|
|
|
import {browser, by, element, ExpectedConditions} from 'protractor';
|
2017-01-12 13:24:51 -08:00
|
|
|
import {screenshot} from '../../screenshot';
|
|
|
|
|
|
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-01-18 23:13:48 +01:00
|
|
|
it('should prevent click handlers from executing when disabled', () => {
|
2016-06-24 11:34:49 -07:00
|
|
|
element(by.id('test-button')).click();
|
|
|
|
|
expect(element(by.id('click-counter')).getText()).toEqual('1');
|
2017-02-16 15:43:29 -08:00
|
|
|
browser.wait(ExpectedConditions.not(
|
|
|
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
|
|
|
|
.then(() => 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-02-16 15:43:29 -08:00
|
|
|
browser.wait(ExpectedConditions.not(
|
|
|
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
|
|
|
|
.then(() => screenshot('click disabled'));
|
2016-04-04 11:32:29 -07:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|