File tree Expand file tree Collapse file tree 4 files changed +55
-3
lines changed
material-experimental/mdc-radio Expand file tree Collapse file tree 4 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 1- <!-- TODO: copy implementation from existing mat-radio e2e page. -->
1+ < section >
2+ < mat-radio-group [disabled] ="isGroupDisabled "
3+ [value] ="groupValue "
4+ id ="test-group " aria-label ="Select a Pokemon ">
5+
6+ < mat-radio-button value ="fire " id ="fire "> Charmander</ mat-radio-button >
7+ < mat-radio-button value ="water " id ="water "> Squirtle</ mat-radio-button >
8+ < mat-radio-button value ="leaf " id ="leaf "> Bulbasaur</ mat-radio-button >
9+
10+ </ mat-radio-group >
11+ < button (click) ="isGroupDisabled=!isGroupDisabled " id ="toggle-disable "> Disable/enable group</ button >
12+ </ section >
Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ import {Component} from '@angular/core';
1313 templateUrl : 'mdc-radio-e2e.html' ,
1414} )
1515export class MdcRadioE2e {
16- // TODO: copy implementation from existing mat-radio e2e page.
16+ isGroupDisabled : boolean = false ;
17+ groupValue : string ;
1718}
Original file line number Diff line number Diff line change 1+ load ("//src/e2e-app:test_suite.bzl" , "e2e_test_suite" )
12load (
23 "//tools:defaults.bzl" ,
4+ "ng_e2e_test_library" ,
35 "ng_module" ,
46 "ng_test_library" ,
57 "ng_web_test_suite" ,
@@ -80,3 +82,19 @@ ng_web_test_suite(
8082 "//src/material-experimental:mdc_require_config.js" ,
8183 ],
8284)
85+
86+ ng_e2e_test_library (
87+ name = "e2e_test_sources" ,
88+ srcs = glob (["**/*.e2e.spec.ts" ]),
89+ deps = [
90+ "//src/cdk/testing/private/e2e" ,
91+ ],
92+ )
93+
94+ e2e_test_suite (
95+ name = "e2e_tests" ,
96+ deps = [
97+ ":e2e_test_sources" ,
98+ "//src/cdk/testing/private/e2e" ,
99+ ],
100+ )
Original file line number Diff line number Diff line change 1- // TODO: copy tests from existing mat-radio, update as necessary to fix.
1+ import { browser , by , element } from 'protractor' ;
2+
3+
4+ describe ( 'radio' , ( ) => {
5+ describe ( 'disabling behavior' , ( ) => {
6+ beforeEach ( async ( ) => await browser . get ( '/mdc-radio' ) ) ;
7+
8+ it ( 'should be checked when clicked' , async ( ) => {
9+ await element ( by . id ( 'water' ) ) . click ( ) ;
10+ expect ( await element ( by . css ( 'input:checked' ) ) . getAttribute ( 'value' ) ) . toBe ( 'water' ) ;
11+
12+ await element ( by . id ( 'leaf' ) ) . click ( ) ;
13+ expect ( await element ( by . css ( 'input:checked' ) ) . getAttribute ( 'value' ) ) . toBe ( 'leaf' ) ;
14+ } ) ;
15+
16+ it ( 'should be disabled when disable the radio group' , async ( ) => {
17+ await element ( by . id ( 'toggle-disable' ) ) . click ( ) ;
18+ await element ( by . id ( 'water' ) ) . click ( ) ;
19+
20+ expect ( await element ( by . css ( 'input[id=water-input]' ) ) . getAttribute ( 'disabled' ) ) . toBe ( 'true' ) ;
21+ } ) ;
22+ } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments