mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
bcf48261f4
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`. * If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @Input is triggered instead of the DOM property) Fixes #5394
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import {browser, by, element, Key, ExpectedConditions} from 'protractor';
|
|
import {screenshot} from '../screenshot';
|
|
|
|
|
|
describe('checkbox', () => {
|
|
|
|
describe('check behavior', () => {
|
|
beforeEach(() => browser.get('/checkbox'));
|
|
|
|
it('should be checked when clicked, and unchecked when clicked again', async () => {
|
|
let checkboxEl = element(by.id('test-checkbox'));
|
|
let inputEl = element(by.css('input[id=test-checkbox-input]'));
|
|
|
|
screenshot('start');
|
|
checkboxEl.click();
|
|
|
|
expect(inputEl.getAttribute('checked'))
|
|
.toBeTruthy('Expect checkbox "checked" property to be true');
|
|
|
|
await browser.wait(ExpectedConditions.not(
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
|
|
screenshot('checked');
|
|
|
|
checkboxEl.click();
|
|
|
|
expect(inputEl.getAttribute('checked'))
|
|
.toBeFalsy('Expect checkbox "checked" property to be false');
|
|
|
|
await browser.wait(ExpectedConditions.not(
|
|
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
|
|
screenshot('unchecked');
|
|
});
|
|
|
|
it('should toggle the checkbox when pressing space', () => {
|
|
let inputEl = element(by.css('input[id=test-checkbox-input]'));
|
|
|
|
expect(inputEl.getAttribute('checked'))
|
|
.toBeFalsy('Expect checkbox "checked" property to be false');
|
|
inputEl.sendKeys(Key.SPACE);
|
|
|
|
expect(inputEl.getAttribute('checked'))
|
|
.toBeTruthy('Expect checkbox "checked" property to be true');
|
|
});
|
|
});
|
|
});
|