angular-cn/modules/playground/e2e_test/zippy_component/zippy_spec.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {browser, by, element} from 'protractor';
2015-06-22 04:52:00 -04:00
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
2015-06-22 04:52:00 -04:00
describe('Zippy Component', function() {
afterEach(verifyNoBrowserErrors);
describe('zippy', function() {
const URL = '/';
2015-06-22 04:52:00 -04:00
beforeEach(function() {
browser.get(URL);
});
2015-06-22 04:52:00 -04:00
it('should change the zippy title depending on it\'s state', function() {
const zippyTitle = element(by.css('.zippy__title'));
2015-06-22 04:52:00 -04:00
expect(zippyTitle.getText()).toEqual('▾ Details');
zippyTitle.click();
expect(zippyTitle.getText()).toEqual('▸ Details');
});
it('should have zippy content', function() {
expect(element(by.css('.zippy__content')).getText()).toEqual('This is some content.');
});
it('should toggle when the zippy title is clicked', function() {
element(by.css('.zippy__title')).click();
expect(element(by.css('.zippy__content')).isDisplayed()).toEqual(false);
element(by.css('.zippy__title')).click();
expect(element(by.css('.zippy__content')).isDisplayed()).toEqual(true);
});
});
});