2017-02-07 00:00:26 +01:00
|
|
|
import {browser, by, element} from 'protractor';
|
2017-01-11 03:11:55 +03:00
|
|
|
|
|
|
|
|
describe('fullscreen', () => {
|
|
|
|
|
|
2017-02-07 00:00:26 +01:00
|
|
|
beforeEach(() => browser.get('/fullscreen'));
|
2017-01-11 03:11:55 +03:00
|
|
|
|
|
|
|
|
it('should open a dialog inside a fullscreen element and move it to the document body', () => {
|
2017-03-03 01:50:05 +01:00
|
|
|
element(by.id('fullscreen-open')).click();
|
|
|
|
|
element(by.id('dialog-open')).click();
|
2017-01-11 03:11:55 +03:00
|
|
|
|
2017-02-07 00:00:26 +01:00
|
|
|
expectOverlayInFullscreen();
|
|
|
|
|
|
2017-03-03 01:50:05 +01:00
|
|
|
element(by.id('dialog-fullscreen-exit')).click();
|
2017-02-07 00:00:26 +01:00
|
|
|
expectOverlayInBody();
|
2017-01-11 03:11:55 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should open a dialog inside the document body and move it to a fullscreen element', () => {
|
2017-03-03 01:50:05 +01:00
|
|
|
element(by.id('dialog-open')).click();
|
2017-02-07 00:00:26 +01:00
|
|
|
expectOverlayInBody();
|
|
|
|
|
|
2017-03-03 01:50:05 +01:00
|
|
|
element(by.id('dialog-fullscreen-open')).click();
|
2017-02-07 00:00:26 +01:00
|
|
|
expectOverlayInFullscreen();
|
|
|
|
|
|
2017-03-03 01:50:05 +01:00
|
|
|
element(by.id('dialog-fullscreen-exit')).click();
|
2017-02-07 00:00:26 +01:00
|
|
|
expectOverlayInBody();
|
2017-01-11 03:11:55 +03:00
|
|
|
});
|
2017-02-07 00:00:26 +01:00
|
|
|
|
|
|
|
|
/** Expects the overlay container to be inside of the body element. */
|
|
|
|
|
function expectOverlayInBody() {
|
2017-03-03 01:50:05 +01:00
|
|
|
expect(browser.isElementPresent(by.css('body > .cdk-overlay-container')))
|
|
|
|
|
.toBe(true, 'Expected the overlay container to be inside of the body.');
|
2017-02-07 00:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Expects the overlay container to be in fullscreen mode. */
|
|
|
|
|
function expectOverlayInFullscreen() {
|
2017-03-03 01:50:05 +01:00
|
|
|
expect(browser.isElementPresent(by.css('#fullscreen-pane > .cdk-overlay-container')))
|
|
|
|
|
.toBe(true, 'Expected the overlay container to be in fullscreen mode.');
|
2017-02-07 00:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-11 03:11:55 +03:00
|
|
|
});
|