File tree Expand file tree Collapse file tree 7 files changed +102
-15
lines changed Expand file tree Collapse file tree 7 files changed +102
-15
lines changed Original file line number Diff line number Diff line change 51
51
"@types/node" : " ^6.0.34" ,
52
52
"@types/run-sequence" : " 0.0.27" ,
53
53
"@types/rx" : " ^2.5.33" ,
54
+ "axe-core" : " ^2.0.7" ,
55
+ "axe-protractor" : " 0.0.7" ,
56
+ "axe-webdriverjs" : " ^0.4.0" ,
54
57
"browserstacktunnel-wrapper" : " ^2.0.0" ,
55
58
"conventional-changelog" : " ^1.1.0" ,
56
59
"express" : " ^4.14.0" ,
80
83
"minimist" : " ^1.2.0" ,
81
84
"node-sass" : " ^3.4.2" ,
82
85
"protractor" : " ^4.0.8" ,
83
- "protractor-accessibility-plugin" : " 0.1.1" ,
84
86
"resolve-bin" : " ^0.4.0" ,
85
87
"rollup" : " ^0.34.13" ,
86
88
"run-sequence" : " ^1.2.2" ,
Original file line number Diff line number Diff line change 1
- < a md-list-item [routerLink] ="['button'] "> Button</ a >
2
- < a md-list-item [routerLink] ="['checkbox'] "> Checkbox</ a >
3
- < a md-list-item [routerLink] ="['dialog'] "> Dialog</ a >
4
- < a md-list-item [routerLink] ="['grid-list'] "> Grid list</ a >
5
- < a md-list-item [routerLink] ="['icon'] "> Icon</ a >
6
- < a md-list-item [routerLink] ="['list'] "> List</ a >
7
- < a md-list-item [routerLink] ="['menu'] "> Menu</ a >
8
- < a md-list-item [routerLink] ="['progress-bar'] "> Progress bar</ a >
9
- < a md-list-item [routerLink] ="['radio'] "> Radios</ a >
10
- < a md-list-item [routerLink] ="['tabs'] "> Tabs</ a >
1
+ < md-nav-list >
2
+ < a md-list-item [routerLink] ="['button'] "> Button</ a >
3
+ < a md-list-item [routerLink] ="['checkbox'] "> Checkbox</ a >
4
+ < a md-list-item [routerLink] ="['dialog'] "> Dialog</ a >
5
+ < a md-list-item [routerLink] ="['grid-list'] "> Grid list</ a >
6
+ < a md-list-item [routerLink] ="['icon'] "> Icon</ a >
7
+ < a md-list-item [routerLink] ="['list'] "> List</ a >
8
+ < a md-list-item [routerLink] ="['menu'] "> Menu</ a >
9
+ < a md-list-item [routerLink] ="['progress-bar'] "> Progress bar</ a >
10
+ < a md-list-item [routerLink] ="['radio'] "> Radios</ a >
11
+ < a md-list-item [routerLink] ="['tabs'] "> Tabs</ a >
12
+ </ md-nav-list >
13
+
14
+ < main >
15
+ < router-outlet role ="main "> </ router-outlet >
16
+ </ main >
11
17
12
- < router-outlet > </ router-outlet >
Original file line number Diff line number Diff line change 1
1
< section >
2
2
< md-radio-group [disabled] ="isGroupDisabled "
3
3
[(value)] ="groupValue "
4
- id ="test-group ">
4
+ id ="test-group " aria-label ="Select a Pokemon ">
5
+
5
6
< md-radio-button value ="fire " id ="fire "> Charmander</ md-radio-button >
6
7
< md-radio-button value ="water " id ="water "> Squirtle</ md-radio-button >
7
8
< md-radio-button value ="leaf " id ="leaf "> Bulbasaur</ md-radio-button >
9
+
8
10
</ md-radio-group >
9
11
< button (click) ="isGroupDisabled=!isGroupDisabled " id ="toggle-disable "> Disable/enable group</ button >
10
12
</ section >
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ const MD_FIT_MODE = 'fit';
35
35
selector : 'md-grid-list' ,
36
36
templateUrl : 'grid-list.html' ,
37
37
styleUrls : [ 'grid-list.css' ] ,
38
+ host : {
39
+ 'role' : 'list'
40
+ } ,
38
41
encapsulation : ViewEncapsulation . None ,
39
42
} )
40
43
export class MdGridList implements OnInit , AfterContentChecked {
Original file line number Diff line number Diff line change @@ -9,15 +9,27 @@ require('ts-node').register({
9
9
10
10
const E2E_BASE_URL = process . env [ 'E2E_BASE_URL' ] || 'http://localhost:4200' ;
11
11
const config = {
12
- // TODO(jelbourn): add back plugin for a11y assersions once it supports specifying AXS options.
13
12
useAllAngular2AppRoots : true ,
14
13
specs : [ path . join ( __dirname , '../e2e/**/*.e2e.ts' ) ] ,
15
14
baseUrl : E2E_BASE_URL ,
16
15
allScriptsTimeout : 120000 ,
17
16
getPageTimeout : 120000 ,
18
17
jasmineNodeOpts : {
19
18
defaultTimeoutInterval : 120000 ,
20
- }
19
+ } ,
20
+
21
+ plugins : [
22
+ {
23
+ // Runs the axe-core accessibility checks each time the e2e page changes and
24
+ // Angular is ready.
25
+ path : '../tools/axe-protractor/axe-protractor.js' ,
26
+
27
+ rules : [
28
+ // Exclude md-menu elements because those are empty if not active.
29
+ { id : 'aria-required-children' , selector : '*:not(.md-menu)' } ,
30
+ ]
31
+ }
32
+ ]
21
33
} ;
22
34
23
35
if ( process . env [ 'TRAVIS' ] ) {
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * Protractor Plugin to run axe-core accessibility audits after Angular bootstrapped.
5
+ */
6
+
7
+ const AxeBuilder = require ( 'axe-webdriverjs' ) ;
8
+ const { buildMessage} = require ( './build-message' ) ;
9
+
10
+ /* List of pages which were already checked by axe-core and shouldn't run again */
11
+ const checkedPages = [ ] ;
12
+
13
+ /**
14
+ * Protractor plugin hook which always runs when Angular successfully bootsrapped.
15
+ */
16
+ function onPageStable ( ) {
17
+ AxeBuilder ( browser . driver )
18
+ . configure ( this . config || { } )
19
+ . analyze ( results => handleResults ( this , results ) ) ;
20
+ }
21
+
22
+ /**
23
+ * Processes the axe-core results by reporting recognized violations
24
+ * to Protractor and printing them out.
25
+ * @param {!protractor.ProtractorPlugin } context
26
+ * @param {axe.AxeResults } results
27
+ */
28
+ function handleResults ( context , results ) {
29
+
30
+ if ( checkedPages . indexOf ( results . url ) !== - 1 ) {
31
+ checkedPages . push ( results . url ) ;
32
+
33
+ results . violations . forEach ( violation => {
34
+
35
+ let specName = `${ violation . help } (${ results . url } )` ;
36
+ let message = '\n' + buildMessage ( violation ) ;
37
+
38
+ context . addFailure ( message , { specName} ) ;
39
+
40
+ } ) ;
41
+
42
+ }
43
+
44
+ }
45
+
46
+ exports . name = 'protractor-axe' ;
47
+ exports . onPageStable = onPageStable ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Builds a simple message of the violation results of axe-core by listing
3
+ * each violation and the associated element selector in a new line.
4
+ * @param {!axe.Violation } violation
5
+ */
6
+ exports . buildMessage = violation => {
7
+
8
+ let selectors = violation . nodes . map ( node => {
9
+ return node . target . join ( ' ' ) ;
10
+ } ) ;
11
+
12
+ return selectors . reduce ( ( content , selector ) => {
13
+ return content + '- ' + selector + '\n' ;
14
+ } , '' ) ;
15
+
16
+ } ;
You can’t perform that action at this time.
0 commit comments