From 9f65bf4bc88a2d83262ad49fc102ee0bc9c88f42 Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 19 Jun 2018 17:05:21 -0800 Subject: [PATCH] better a11y related scenery logging for tests, https://github.com/phetsims/scenery/issues/715 --- js/accessibility/AccessibilityTests.js | 34 ++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/js/accessibility/AccessibilityTests.js b/js/accessibility/AccessibilityTests.js index 7f8aeb709..60ee976b6 100644 --- a/js/accessibility/AccessibilityTests.js +++ b/js/accessibility/AccessibilityTests.js @@ -18,8 +18,6 @@ define( function( require ) { var Rectangle = require( 'SCENERY/nodes/Rectangle' ); var scenery = require( 'SCENERY/scenery' ); - QUnit.module( 'Accessibility' ); - // constants var TEST_INNER_CONTENT = 'Test Inner Content Here please^&*. Thanks you so very mucho.'; var TEST_LABEL = 'Test label'; @@ -43,10 +41,24 @@ define( function( require ) { // a focus highlight for testing, since dummy nodes tend to have no bounds var TEST_HIGHLIGHT = new Circle( 5 ); - // add scenery logging for a11y in this unit test module, make sure it is turned off at the end of the file. - if ( window.location.search.indexOf( 'a11yLog' ) >= 0 ) { - scenery.enableLogging( ['a11y'] ); - } + QUnit.module( 'Accessibility', { + before: function() { + // add scenery logging for a11y in this unit test module, make sure it is turned off at the end of the file. + if ( window.location.search.indexOf( 'a11yLog' ) >= 0 ) { + scenery.enableLogging( [ 'a11y' ] ); + } + + }, + after: function() { + // remove the logging that we added at the top + if ( window.location.search.indexOf( 'a11yLog' ) >= 0 ) { + scenery.disableIndividualLog( 'Accessibility' ); + scenery.disableIndividualLog( 'AccessibleInstance' ); + scenery.disableIndividualLog( 'AccessibilityTree' ); + scenery.disableIndividualLog( 'AccessibleDisplaysInfo' ); + } + } + } ); /** * Get the id of a dom element representing a node in the DOM. The accessible content must exist and be unique, @@ -1125,7 +1137,7 @@ define( function( require ) { QUnit.test( 'helpText option', function( assert ) { - assert.ok( true); + assert.ok( true ); // // TODO: this is failing, but ideally it wouldn't see https://github.com/phetsims/scenery/issues/811 // // test the behavior of focusable function @@ -1199,12 +1211,4 @@ define( function( require ) { } assert.expect( 0 ); } ); - - // remove the logging that we added at the top - if ( window.location.search.indexOf( 'a11yLog' ) >= 0 ) { - scenery.disableIndividualLog( 'Accessibility' ); - scenery.disableIndividualLog( 'AccessibleInstance' ); - scenery.disableIndividualLog( 'AccessibilityTree' ); - scenery.disableIndividualLog( 'AccessibleDisplaysInfo' ); - } } ); \ No newline at end of file