Files
angular__angular/e2e/components/checkbox-e2e.spec.ts
T
Kristiyan Kostadinov 411fce3901 chore: fix checkbox lint warning (#13209)
Fixes an unused import that got into master.

**Note:** targeting major, because I think that it got introduced in the PR for the checkbox design changes.
2018-09-20 09:19:08 -07:00

35 lines
1.1 KiB
TypeScript

import {browser, by, element, Key} from 'protractor';
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]'));
checkboxEl.click();
expect(inputEl.getAttribute('checked'))
.toBeTruthy('Expect checkbox "checked" property to be true');
checkboxEl.click();
expect(inputEl.getAttribute('checked'))
.toBeFalsy('Expect checkbox "checked" property to be false');
});
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');
});
});
});