Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit f5ab70b

Browse files
author
george
committed
add dom and getFocusableElements helper tests
1 parent 2105f6e commit f5ab70b

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

src/js/__tests__/utils.spec.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
1-
import ContextUtil, { browserEnv, dom, getFocusableElements, iOSMobile } from "../utils"
1+
import ContextUtil, { dom, getFocusableElements } from "../utils"
2+
3+
const testDom = `<div data-tester="true" data-removable class="wrapper">
4+
<p>Hello world! <a href="#">this link is focusable</a> </p>
5+
<p class="hello world test">Hello world again! <button type="button">I too, am focusable!</button></p>
6+
</div>\
7+
`
8+
9+
describe("dom", () => {
10+
beforeEach(() => {
11+
document.body.innerHTML = testDom
12+
})
13+
14+
it("can get an attribute", () => {})
15+
it("can set an attribute", () => {})
16+
it("can remove an attribute", () => {})
17+
it("can detect an attribute", () => {})
18+
it("can retrieve an element", () => {})
19+
it("can retrieve a collection of elements", () => {})
20+
it("can retrieve css properties", () => {})
21+
it("can set css properties", () => {})
22+
it("can add a class", () => {})
23+
it("can add multiple classes", () => {})
24+
it("can remove a class from", () => {})
25+
it("can remove multiple classes from", () => {})
26+
it("can detect a class", () => {})
27+
it("can detect a class from multiple inputs", () => {})
28+
})
29+
30+
describe("getFocusableElements", () => {
31+
it("returns all focusable elements within a wrapper", () => {
32+
document.body.innerHTML = testDom
33+
const elements = getFocusableElements(".wrapper")
34+
expect(elements).toHaveLength(2)
35+
})
36+
})
237

3-
describe("browserEnv", () => {})
4-
describe("dom", () => {})
5-
describe("getFocusableElements", () => {})
6-
describe("iOSMobile", () => {})
738
describe("ContextUtil", () => {})

0 commit comments

Comments
 (0)