Skip to content

Commit 8d69432

Browse files
jelbournmhevery
authored andcommitted
chore(material): add e2e smoke tests for a few more components.
Closes angular#1884
1 parent 3011cd8 commit 8d69432

File tree

7 files changed

+63
-8
lines changed

7 files changed

+63
-8
lines changed

modules/angular2_material/src/components/radio/radio-button.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ md-radio-button {
1616

1717
md-radio-group {
1818
border: 1px dotted transparent;
19-
display: block;
19+
display: inline-block;
2020
outline: none;
2121
}
2222

@@ -71,6 +71,11 @@ md-radio-group {
7171
width: auto;
7272
}
7373

74+
.md-radio-root {
75+
display: block;
76+
cursor: pointer;
77+
}
78+
7479

7580
// THEME
7681

modules/angular2_material/src/components/radio/radio_button.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<!-- TODO(jelbourn): render the radio on either side of the content -->
44

5-
<label role="radio"
5+
<label role="radio" class="md-radio-root"
66
[class.md-radio-checked]="checked"
7-
(^click)="select($event)" >
7+
(^click)="select($event)">
88
<!-- The actual `radio` part of the control. -->
99
<div class="md-radio-container">
1010
<div class="md-radio-off"></div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var testUtil = require('angular2/src/test_lib/e2e_util');
2+
3+
describe('md-grid-list', function () {
4+
var url = 'examples/src/material/grid_list/index.html';
5+
6+
beforeEach(() => { browser.get(url); });
7+
afterEach(testUtil.verifyNoBrowserErrors);
8+
9+
it('should set tiles into different positions', () => {
10+
var tiles = element.all(by.css('md-grid-list#complex md-grid-tile'));
11+
12+
// If the grid-list was not doing any layout, all of the tiles would have the same position.
13+
// So our smoke test simply checks that any two tiles are in different positions.
14+
expect(tiles.first().getLocation()).not.toEqual(tiles.last().getLocation());
15+
});
16+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var testUtil = require('angular2/src/test_lib/e2e_util');
2+
3+
describe('md-input', function () {
4+
var url = 'examples/src/material/input/index.html';
5+
6+
beforeEach(() => { browser.get(url); });
7+
afterEach(testUtil.verifyNoBrowserErrors);
8+
9+
it('should enter a value to the input', () => {
10+
var input = element.all(by.css('md-input-container input')).first();
11+
12+
input.sendKeys('Hello');
13+
14+
expect(input.getAttribute('value')).toBe('Hello');
15+
});
16+
});
17+

modules/examples/e2e_test/material/radio_spec.es6

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,16 @@ describe('md-radio-button', function () {
66
beforeEach(() => { browser.get(url); });
77
afterEach(testUtil.verifyNoBrowserErrors);
88

9-
// Radio buttons are broken right now, see https://github.com/angular/angular/issues/1643
9+
it('should check one radio button and then check another', () => {
10+
var standaloneRadios = element.all(by.css('[name="element"]'));
11+
var firstRadio = standaloneRadios.first();
12+
var lastRadio = standaloneRadios.last();
13+
14+
firstRadio.click();
15+
expect(firstRadio.getAttribute('aria-checked')).toBe('true');
16+
17+
lastRadio.click();
18+
expect(firstRadio.getAttribute('aria-checked')).toBe('false');
19+
expect(lastRadio.getAttribute('aria-checked')).toBe('true');
20+
});
1021
});

modules/examples/src/material/grid_list/demo_app.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<h2>grid-list demo</h2>
1414

15-
<md-grid-list cols="4" row-height="50px" gutter-size="2em">
15+
<md-grid-list cols="4" row-height="50px" gutter-size="2em" id="complex">
1616

1717
<md-grid-tile rowspan="1" colspan="2"> Tile #1 </md-grid-tile>
1818
<md-grid-tile rowspan="1" colspan="1"> Tile #2 </md-grid-tile>
@@ -26,7 +26,7 @@ <h2>grid-list demo</h2>
2626

2727

2828

29-
<md-grid-list cols="4" row-height="50px" gutter-size="2em">
29+
<md-grid-list cols="4" row-height="50px" gutter-size="2em" id="simple">
3030

3131
<md-grid-tile rowspan="1" colspan="1"> Tile #1 </md-grid-tile>
3232
<md-grid-tile rowspan="1" colspan="1"> Tile #2 </md-grid-tile>

modules/examples/src/material/radio/demo_app.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<style>
2+
md-radio-button {
3+
max-width: 200px;
4+
}
5+
</style>
6+
17
<div>
28
<h2>Radio buttons</h2>
39
<h3>Inside of a radiogroup</h3>
@@ -17,8 +23,8 @@ <h3>Standalone</h3>
1723

1824
<md-radio-button name="element" (^click)="onIndividualClick()">Earth</md-radio-button>
1925
<md-radio-button name="element" (^click)="onIndividualClick()">Fire</md-radio-button>
20-
<md-radio-button name="element" (^click)="onIndividualClick()">Wind</md-radio-button>
21-
<md-radio-button name="element" (^click)="onIndividualClick()" disabled>Heart (disabled)</md-radio-button>
26+
<md-radio-button name="element" (^click)="onIndividualClick()" disabled>Wind (disabled)</md-radio-button>
27+
<md-radio-button name="element" (^click)="onIndividualClick()">Heart</md-radio-button>
2228

2329
<p>individual radio value change count: {{individualValueChanges}}</p>
2430

0 commit comments

Comments
 (0)