Skip to content

Commit df68323

Browse files
committed
Create Expansion Panel.
1 parent 945aa43 commit df68323

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1060
-373
lines changed

e2e/components/block-scroll-strategy/block-scroll-strategy.e2e.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {browser, Key, element, by} from 'protractor';
22
import {screenshot} from '../../screenshot';
3-
import {getScrollPosition} from '../../util/query';
3+
import {getScrollPosition} from '../../util/index';
44

55

66
describe('scroll blocking', () => {
77
beforeEach(() => browser.get('/block-scroll-strategy'));
88
afterEach(() => clickOn('disable'));
99

10-
it('should not be able to scroll programmatically along the x axis', async (done) => {
10+
it('should not be able to scroll programmatically along the x axis', async () => {
1111
scrollPage(0, 100);
1212
expect((await getScrollPosition()).y).toBe(100, 'Expected the page to be scrollable.');
1313

@@ -20,10 +20,9 @@ describe('scroll blocking', () => {
2020
expect((await getScrollPosition()).y).toBe(300, 'Exected page to be scrollable again.');
2121

2222
screenshot();
23-
done();
2423
});
2524

26-
it('should not be able to scroll programmatically along the y axis', async (done) => {
25+
it('should not be able to scroll programmatically along the y axis', async () => {
2726
scrollPage(100, 0);
2827
expect((await getScrollPosition()).x).toBe(100, 'Expected the page to be scrollable.');
2928

@@ -36,10 +35,9 @@ describe('scroll blocking', () => {
3635
expect((await getScrollPosition()).x).toBe(300, 'Exected page to be scrollable again.');
3736

3837
screenshot();
39-
done();
4038
});
4139

42-
it('should not be able to scroll via the keyboard along the y axis', async (done) => {
40+
it('should not be able to scroll via the keyboard along the y axis', async () => {
4341
const body = element(by.tagName('body'));
4442

4543
scrollPage(0, 100);
@@ -59,10 +57,9 @@ describe('scroll blocking', () => {
5957
.toBeGreaterThan(100, 'Expected the page to be scrollable again.');
6058

6159
screenshot();
62-
done();
6360
});
6461

65-
it('should not be able to scroll via the keyboard along the x axis', async (done) => {
62+
it('should not be able to scroll via the keyboard along the x axis', async () => {
6663
const body = element(by.tagName('body'));
6764

6865
scrollPage(100, 0);
@@ -82,11 +79,10 @@ describe('scroll blocking', () => {
8279
.toBeGreaterThan(100, 'Expected the page to be scrollable again.');
8380

8481
screenshot();
85-
done();
8682
});
8783

8884
it('should not be able to scroll the page after reaching the end of an element along the y axis',
89-
async (done) => {
85+
async () => {
9086
const scroller = element(by.id('scroller'));
9187

9288
browser.executeScript(`document.getElementById('scroller').scrollTop = 200;`);
@@ -100,11 +96,10 @@ describe('scroll blocking', () => {
10096
expect((await getScrollPosition()).y).toBe(100, 'Expected the page not to have scrolled.');
10197

10298
screenshot();
103-
done();
10499
});
105100

106101
it('should not be able to scroll the page after reaching the end of an element along the x axis',
107-
async (done) => {
102+
async () => {
108103
const scroller = element(by.id('scroller'));
109104

110105
browser.executeScript(`document.getElementById('scroller').scrollLeft = 200;`);
@@ -118,7 +113,6 @@ describe('scroll blocking', () => {
118113
expect((await getScrollPosition()).x).toBe(100, 'Expected the page not to have scrolled.');
119114

120115
screenshot();
121-
done();
122116
});
123117
});
124118

e2e/components/button/button.e2e.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ describe('button', () => {
66
describe('disabling behavior', () => {
77
beforeEach(() => browser.get('/button'));
88

9-
it('should prevent click handlers from executing when disabled', () => {
9+
it('should prevent click handlers from executing when disabled', async () => {
1010
element(by.id('test-button')).click();
1111
expect(element(by.id('click-counter')).getText()).toEqual('1');
12-
browser.wait(ExpectedConditions.not(
13-
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
14-
.then(() => screenshot('clicked once'));
12+
13+
await browser.wait(ExpectedConditions.not(
14+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
15+
screenshot('clicked once');
1516

1617
element(by.id('disable-toggle')).click();
1718
element(by.id('test-button')).click();
1819
expect(element(by.id('click-counter')).getText()).toEqual('1');
19-
browser.wait(ExpectedConditions.not(
20-
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
21-
.then(() => screenshot('click disabled'));
20+
21+
await browser.wait(ExpectedConditions.not(
22+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
23+
screenshot('click disabled');
2224
});
2325
});
2426
});
Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
import {browser, by, element, Key, ExpectedConditions} from 'protractor';
22
import {screenshot} from '../../screenshot';
33

4-
describe('checkbox', function () {
54

6-
describe('check behavior', function () {
5+
describe('checkbox', () => {
76

8-
beforeEach(function() {
9-
browser.get('/checkbox');
10-
});
7+
describe('check behavior', () => {
8+
beforeEach(() => browser.get('/checkbox'));
119

12-
it('should be checked when clicked, and be unchecked when clicked again', () => {
10+
it('should be checked when clicked, and unchecked when clicked again', async () => {
1311
let checkboxEl = element(by.id('test-checkbox'));
1412
let inputEl = element(by.css('input[id=input-test-checkbox]'));
13+
let checked: string;
1514

1615
screenshot('start');
1716
checkboxEl.click();
18-
inputEl.getAttribute('checked').then((value: string) => {
19-
expect(value).toBeTruthy('Expect checkbox "checked" property to be true');
20-
browser.wait(ExpectedConditions.not(
21-
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
22-
.then(() => screenshot('checked'));
23-
});
17+
18+
expect(inputEl.getAttribute('checked'))
19+
.toBeTruthy('Expect checkbox "checked" property to be true');
20+
21+
await browser.wait(ExpectedConditions.not(
22+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
23+
screenshot('checked');
2424

2525
checkboxEl.click();
26-
inputEl.getAttribute('checked').then((value: string) => {
27-
expect(value).toBeFalsy('Expect checkbox "checked" property to be false');
28-
browser.wait(ExpectedConditions.not(
29-
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
30-
.then(() => screenshot('unchecked'));
31-
});
26+
27+
expect(inputEl.getAttribute('checked'))
28+
.toBeFalsy('Expect checkbox "checked" property to be false');
29+
30+
await browser.wait(ExpectedConditions.not(
31+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
32+
screenshot('unchecked');
3233
});
3334

3435
it('should toggle the checkbox when pressing space', () => {
3536
let inputEl = element(by.css('input[id=input-test-checkbox]'));
3637

37-
inputEl.getAttribute('checked').then((value: string) => {
38-
expect(value).toBeFalsy('Expect checkbox "checked" property to be false');
39-
});
40-
38+
expect(inputEl.getAttribute('checked'))
39+
.toBeFalsy('Expect checkbox "checked" property to be false');
4140
inputEl.sendKeys(Key.SPACE);
4241

43-
inputEl.getAttribute('checked').then((value: string) => {
44-
expect(value).toBeTruthy('Expect checkbox "checked" property to be true');
45-
});
42+
expect(inputEl.getAttribute('checked'))
43+
.toBeTruthy('Expect checkbox "checked" property to be true');
4644
});
4745
});
4846
});

e2e/components/dialog/dialog.e2e.ts

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import {browser, by, element, Key} from 'protractor';
2-
import {expectToExist, expectFocusOn} from '../../util/asserts';
3-
import {pressKeys, clickElementAtPoint} from '../../util/actions';
4-
import {waitForElement} from '../../util/query';
2+
import {
3+
expectToExist,
4+
expectFocusOn,
5+
pressKeys,
6+
clickElementAtPoint,
7+
waitForElement,
8+
} from '../../util/index';
9+
510

611
describe('dialog', () => {
712
beforeEach(() => browser.get('/dialog'));
@@ -17,89 +22,79 @@ describe('dialog', () => {
1722
expectToExist('.my-template-dialog');
1823
});
1924

20-
it('should close by clicking on the backdrop', () => {
25+
it('should close by clicking on the backdrop', async() => {
2126
element(by.id('default')).click();
2227

23-
waitForDialog().then(() => {
24-
clickOnBackrop();
25-
expectToExist('md-dialog-container', false);
26-
});
28+
await waitForDialog();
29+
clickOnBackrop();
30+
expectToExist('md-dialog-container', false);
2731
});
2832

29-
it('should close by pressing escape', () => {
33+
it('should close by pressing escape', async () => {
3034
element(by.id('default')).click();
3135

32-
waitForDialog().then(() => {
33-
pressKeys(Key.ESCAPE);
34-
expectToExist('md-dialog-container', false);
35-
});
36+
await waitForDialog();
37+
pressKeys(Key.ESCAPE);
38+
expectToExist('md-dialog-container', false);
3639
});
3740

38-
it('should close by pressing escape when the first tabbable element has lost focus', () => {
39-
element(by.id('default')).click();
41+
it('should close by pressing escape when the first tabbable element has lost focus',
42+
async () => {
43+
element(by.id('default')).click();
4044

41-
waitForDialog().then(() => {
45+
await waitForDialog();
4246
clickElementAtPoint('md-dialog-container', { x: 0, y: 0 });
4347
pressKeys(Key.ESCAPE);
4448
expectToExist('md-dialog-container', false);
4549
});
46-
});
4750

48-
it('should close by clicking on the "close" button', () => {
51+
it('should close by clicking on the "close" button', async () => {
4952
element(by.id('default')).click();
5053

51-
waitForDialog().then(() => {
52-
element(by.id('close')).click();
53-
expectToExist('md-dialog-container', false);
54-
});
54+
await waitForDialog();
55+
element(by.id('close')).click();
56+
expectToExist('md-dialog-container', false);
5557
});
5658

57-
it('should focus the first focusable element', () => {
59+
it('should focus the first focusable element', async () => {
5860
element(by.id('default')).click();
5961

60-
waitForDialog().then(() => {
61-
expectFocusOn('md-dialog-container input');
62-
});
62+
await waitForDialog();
63+
expectFocusOn('md-dialog-container input');
6364
});
6465

65-
it('should restore focus to the element that opened the dialog', () => {
66+
it('should restore focus to the element that opened the dialog', async () => {
6667
let openButton = element(by.id('default'));
6768

6869
openButton.click();
6970

70-
waitForDialog().then(() => {
71-
clickOnBackrop();
72-
expectFocusOn(openButton);
73-
});
71+
await waitForDialog();
72+
clickOnBackrop();
73+
expectFocusOn(openButton);
7474
});
7575

76-
it('should prevent tabbing out of the dialog', () => {
76+
it('should prevent tabbing out of the dialog', async () => {
7777
element(by.id('default')).click();
7878

79-
waitForDialog().then(() => {
80-
let tab = Key.TAB;
81-
82-
pressKeys(tab, tab, tab);
83-
expectFocusOn('#close');
84-
});
79+
await waitForDialog();
80+
pressKeys(Key.TAB, Key.TAB, Key.TAB);
81+
expectFocusOn('#close');
8582
});
8683

87-
it('should be able to prevent closing by clicking on the backdrop', () => {
84+
it('should be able to prevent closing by clicking on the backdrop', async () => {
8885
element(by.id('disabled')).click();
8986

90-
waitForDialog().then(() => {
91-
clickOnBackrop();
92-
expectToExist('md-dialog-container');
93-
});
87+
await waitForDialog();
88+
clickOnBackrop();
89+
expectToExist('md-dialog-container');
9490
});
9591

96-
it('should be able to prevent closing by pressing escape', () => {
92+
it('should be able to prevent closing by pressing escape', async () => {
9793
element(by.id('disabled')).click();
9894

99-
waitForDialog().then(() => {
100-
pressKeys(Key.ESCAPE);
101-
expectToExist('md-dialog-container');
102-
});
95+
await waitForDialog();
96+
pressKeys(Key.ESCAPE);
97+
expectToExist('md-dialog-container');
10398
});
10499

105100
function waitForDialog() {

e2e/components/grid-list/grid-list.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {browser} from 'protractor';
2-
import {expectToExist} from '../../util/asserts';
2+
import {expectToExist} from '../../util/index';
33
import {screenshot} from '../../screenshot';
44

55
describe('grid-list', () => {

e2e/components/icon/icon.e2e.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {browser, by, element} from 'protractor';
22
import {screenshot} from '../../screenshot';
33

4+
45
describe('icon', () => {
56
describe('font icons by ligature', () => {
67
let testIcon: any;
@@ -11,23 +12,19 @@ describe('icon', () => {
1112
});
1213

1314
it('should have the correct aria-label when used', () => {
14-
testIcon.getAttribute('aria-label').then((attr: string) => {
15-
expect(attr).toEqual('favorite');
16-
});
15+
expect(testIcon.getAttribute('aria-label')).toBe('favorite');
1716
screenshot();
1817
});
1918

20-
it('should have the correct class when used', () => {
21-
testIcon.getAttribute('class').then((attr: string) => {
22-
expect(attr).toContain('md-24');
23-
expect(attr).toContain('material-icons');
24-
});
19+
it('should have the correct class when used', async () => {
20+
const attr = await testIcon.getAttribute('class');
21+
22+
expect(attr).toContain('md-24');
23+
expect(attr).toContain('material-icons');
2524
});
2625

2726
it('should have the correct role when used', () => {
28-
testIcon.getAttribute('role').then((attr: string) => {
29-
expect(attr).toEqual('img');
30-
});
27+
expect(testIcon.getAttribute('role')).toBe('img');
3128
});
3229
});
3330
});

0 commit comments

Comments
 (0)