Skip to content

Commit

Permalink
fix incorrect tests, #715
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jun 20, 2018
1 parent 905b449 commit 546b733
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions js/accessibility/AccessibilityTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,44 +159,10 @@ define( function( require ) {

assert.ok( a.accessibleInstances[ 0 ].peer.containerParent.id.indexOf( 'container' ) >= 0, 'container parent is div if specified' );

var b = new Node( { tagName: 'button', labelTagName: 'div', labelContent: TEST_LABEL } );
a.containerTagName = null;

rootNode.addChild( b );
var buttonElement = b.accessibleInstances[ 0 ].peer.primarySibling;
var parentElement = buttonElement.parentElement;

assert.ok( b.containerTagName === DEFAULT_CONTAINER_TAG_NAME, 'container automatically created for label' );

assert.ok( parentElement, 'parent element must be created with label option' );
assert.ok( parentElement.childNodes.length === 2, 'only contain label and primary siblings' );

assert.ok( parentElement.childNodes[ 1 ] === getPrimarySiblingElementByNode( b ), 'primary sibling after label sibling.' );
assert.ok( !a.accessibleInstances[ 0 ].peer.containerParent, 'container parent is cleared if specified' );


var c = new Node( { tagName: 'button', descriptionTagName: 'div', descriptionContent: TEST_DESCRIPTION } );

rootNode.addChild( c );
buttonElement = c.accessibleInstances[ 0 ].peer.primarySibling;
parentElement = buttonElement.parentElement;


assert.ok( parentElement, 'parent element must be created with description option' );
assert.ok( parentElement.childNodes.length === 2, 'only contain description and primary siblings' );

c.containerTagName = 'SECTION';
assert.ok( getPrimarySiblingElementByNode( c ).parentElement.tagName === 'SECTION', 'containerTagName should update default' );

var d = new Node( { tagName: 'button', labelTagName: 'p', descriptionTagName: 'p' } );
rootNode.addChild( d );
assert.ok( getPrimarySiblingElementByNode( d ).parentElement.childNodes.length === 3, 'correct children' );

var e = new Node( {
tagName: 'div',
labelContent: TEST_LABEL,
containerTagName: 'SECTION'
} );
rootNode.addChild( e );
assert.ok( getPrimarySiblingElementByNode( e ).parentElement.tagName === 'SECTION', 'containerTagName should update default in options block' );
} );

QUnit.test( 'labelTagName/labelContent option', function( assert ) {
Expand Down

0 comments on commit 546b733

Please sign in to comment.