aria-api

access ARIA information from JavaScript
git clone https://git.ce9e.org/aria-api.git

commit
91d1a4aa54f7ed517078e09ed08289fcfb22bea3
parent
c0a76e1bc4da46f3e43889e23556ab369f69e1ce
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-02-02 15:38
wpt: split wpt tests

Diffstat

M test/index.html 1 +
M test/test-name.js 23 -----------------------
C test/test-name.js -> test/test-wpt.js 14 +-------------

3 files changed, 2 insertions, 36 deletions


diff --git a/test/index.html b/test/index.html

@@ -19,6 +19,7 @@
   19    19     <script src="test-hidden.js"></script>
   20    20     <script src="test-conflict.js"></script>
   21    21     <script src="test-loop.js"></script>
   -1    22     <script src="test-wpt.js"></script>
   22    23     <script>mocha.run()</script>
   23    24 </body>
   24    25 </html>

diff --git a/test/test-name.js b/test/test-name.js

@@ -1,9 +1,5 @@
    1     1 describe('getName / getDescription', () => {
    2     2 	var testbed = document.createElement('div');
    3    -1 	var known_failing = [
    4    -1 		'Name test case 660',
    5    -1 		'Name test case 659',
    6    -1 	];
    7     3 
    8     4 	before(() => {
    9     5 		document.body.appendChild(testbed);
@@ -13,25 +9,6 @@ describe('getName / getDescription', () => {
   13     9 		document.body.removeChild(testbed);
   14    10 	});
   15    11 
   16    -1 	window.wpt.accname.forEach(test => {
   17    -1 		var _it = known_failing.includes(test.title) ? xit : it;
   18    -1 		_it(test.title, () => {
   19    -1 			testbed.innerHTML = test.html;
   20    -1 			for (var element of document.querySelectorAll(test.selector)) {
   21    -1 				var name = element.dataset.expectedlabel ?? test.name;
   22    -1 				var description = element.dataset.expecteddescription ?? test.description;
   23    -1 				expect(name ?? description).toNotBe(null);
   24    -1 
   25    -1 				if (name !== null) {
   26    -1 					expect(aria.getName(element)).toBe(name);
   27    -1 				}
   28    -1 				if (description !== null) {
   29    -1 					expect(aria.getDescription(element)).toBe(description);
   30    -1 				}
   31    -1 			}
   32    -1 		});
   33    -1 	});
   34    -1 
   35    12 	it('ignores <noscript>', () => {
   36    13 		testbed.innerHTML = '<a id="test" href="#">test <noscript>moo</noscript></a>';
   37    14 		var element = document.querySelector('#test');

diff --git a/test/test-name.js b/test/test-wpt.js

@@ -1,4 +1,4 @@
    1    -1 describe('getName / getDescription', () => {
   -1     1 describe('wpt', () => {
    2     2 	var testbed = document.createElement('div');
    3     3 	var known_failing = [
    4     4 		'Name test case 660',
@@ -31,16 +31,4 @@ describe('getName / getDescription', () => {
   31    31 			}
   32    32 		});
   33    33 	});
   34    -1 
   35    -1 	it('ignores <noscript>', () => {
   36    -1 		testbed.innerHTML = '<a id="test" href="#">test <noscript>moo</noscript></a>';
   37    -1 		var element = document.querySelector('#test');
   38    -1 		expect(aria.getName(element)).toBe('test');
   39    -1 	});
   40    -1 
   41    -1 	it('ignores <img alt="">', () => {
   42    -1 		testbed.innerHTML = '<img id="test" alt="" title="title">'
   43    -1 		var element = document.querySelector('#test');
   44    -1 		expect(aria.getName(element)).toBe('');
   45    -1 	});
   46    34 });