@@ -8,7 +8,7 @@ module('Integration | Components | Radio Button', function (hooks) {
88 setupRenderingTest ( hooks ) ;
99
1010 test ( 'begins checked when groupValue matches value' , async function ( assert ) {
11- assert . expect ( 1 ) ;
11+ assert . expect ( 2 ) ;
1212
1313 await render ( hbs `
1414 <RadioButton
@@ -18,18 +18,20 @@ module('Integration | Components | Radio Button', function (hooks) {
1818 ` ) ;
1919
2020 assert . dom ( 'input' ) . isChecked ( ) ;
21+ assert . dom ( 'input' ) . hasAttribute ( 'aria-checked' , 'true' ) ;
2122 } ) ;
2223
2324 test ( 'it updates when clicked, and triggers the `changed` action' , async function ( assert ) {
24- assert . expect ( 5 ) ;
25+ assert . expect ( 7 ) ;
2526
2627 let changedActionCallCount = 0 ;
2728
2829 this . set ( 'groupValue' , 'initial-group-value' ) ;
2930
30- this . set ( 'changed' , function ( newValue ) {
31+ this . set ( 'changed' , ( newValue ) => {
3132 changedActionCallCount ++ ;
3233 assert . strictEqual ( newValue , 'component-value' , 'updates groupValue' ) ;
34+ this . set ( 'groupValue' , newValue ) ;
3335 } ) ;
3436
3537 await render ( hbs `
@@ -42,10 +44,20 @@ module('Integration | Components | Radio Button', function (hooks) {
4244
4345 assert . strictEqual ( changedActionCallCount , 0 ) ;
4446 assert . dom ( 'input' ) . isNotChecked ( ) ;
47+ assert
48+ . dom ( 'input' )
49+ . hasAttribute (
50+ 'aria-checked' ,
51+ 'false' ,
52+ 'aria-checked property starts false'
53+ ) ;
4554
4655 await triggerEvent ( 'input' , 'click' ) ;
4756
4857 assert . dom ( 'input' ) . isChecked ( 'updates element property' ) ;
58+ assert
59+ . dom ( 'input' )
60+ . hasAttribute ( 'aria-checked' , 'true' , 'updates aria-checked property' ) ;
4961
5062 assert . strictEqual ( changedActionCallCount , 1 ) ;
5163 } ) ;
0 commit comments