Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/dom_util_test.js

Issue 517853002: ChromeVox should not speak live regions that aren't in the document. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/dom_util.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Include test fixture. 5 // Include test fixture.
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']);
7 7
8 /** 8 /**
9 * Test fixture. 9 * Test fixture.
10 * @constructor 10 * @constructor
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 node = $('nested_display_block'); 134 node = $('nested_display_block');
135 assertEquals(false, cvox.DomUtil.isVisible(node)); 135 assertEquals(false, cvox.DomUtil.isVisible(node));
136 136
137 // Options tests (for performance). 137 // Options tests (for performance).
138 node = $('nested_display_block'); 138 node = $('nested_display_block');
139 assertEquals(true, 139 assertEquals(true,
140 cvox.DomUtil.isVisible(node, {checkAncestors: false})); 140 cvox.DomUtil.isVisible(node, {checkAncestors: false}));
141 node = $('nested_visibility_hide'); 141 node = $('nested_visibility_hide');
142 assertEquals(false, 142 assertEquals(false,
143 cvox.DomUtil.isVisible(node, {checkDescendants: false})); 143 cvox.DomUtil.isVisible(node, {checkDescendants: false}));
144
145 // Test that an element not part of the DOM is treated as invisible.
146 var div = document.createElement('div');
147 assertEquals(false, cvox.DomUtil.isVisible(div));
148 document.body.appendChild(div);
149 assertEquals(true, cvox.DomUtil.isVisible(div));
144 }); 150 });
145 151
146 /** Test determining if a node is a leaf node or not. @export */ 152 /** Test determining if a node is a leaf node or not. @export */
147 TEST_F('CvoxDomUtilUnitTest', 'IsLeafNode', function() { 153 TEST_F('CvoxDomUtilUnitTest', 'IsLeafNode', function() {
148 this.loadDomUtilTestDoc_(); 154 this.loadDomUtilTestDoc_();
149 155
150 var node = $('normal_node'); 156 var node = $('normal_node');
151 assertEquals(false, cvox.DomUtil.isLeafNode(node)); 157 assertEquals(false, cvox.DomUtil.isLeafNode(node));
152 node = $('display_none'); 158 node = $('display_none');
153 assertEquals(true, cvox.DomUtil.isLeafNode(node)); 159 assertEquals(true, cvox.DomUtil.isLeafNode(node));
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 cvox.Memoize.scope(function() { 1569 cvox.Memoize.scope(function() {
1564 container.style.visibility = 'hidden'; 1570 container.style.visibility = 'hidden';
1565 assertFalse(cvox.DomUtil.isVisible(target)); 1571 assertFalse(cvox.DomUtil.isVisible(target));
1566 1572
1567 container.style.visibility = 'visible'; 1573 container.style.visibility = 'visible';
1568 // This should be true! It will return the wrong answer because 1574 // This should be true! It will return the wrong answer because
1569 // we're deliberately leaving memoization on while modifying the DOM. 1575 // we're deliberately leaving memoization on while modifying the DOM.
1570 assertFalse(cvox.DomUtil.isVisible(target)); 1576 assertFalse(cvox.DomUtil.isVisible(target));
1571 }); 1577 });
1572 }); 1578 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/dom_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698