-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathregionSelectingPanel_tests.tsx
More file actions
47 lines (35 loc) · 1.47 KB
/
regionSelectingPanel_tests.tsx
File metadata and controls
47 lines (35 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {Constants} from "../../../scripts/constants";
import {RegionSelectingPanel} from "../../../scripts/clipperUI/panels/regionSelectingPanel";
import {MithrilUtils} from "../../mithrilUtils";
import {MockProps} from "../../mockProps";
import {TestModule} from "../../testModule";
export class RegionSelectingPanelTests extends TestModule {
private mockRegionSelectingPanelProps = {
clipperState: MockProps.getMockClipperState()
};
private defaultComponent;
protected module() {
return "regionSelectingPanel";
}
protected beforeEach() {
this.defaultComponent = <RegionSelectingPanel {...this.mockRegionSelectingPanelProps}/>;
}
protected tests() {
test("The region selecting panel should render the 'Back to Home' button", () => {
MithrilUtils.mountToFixture(this.defaultComponent);
let button = document.getElementById(Constants.Ids.regionClipCancelButton);
ok(button, "The 'Back to Home' button should be present");
});
test("The region selecting panel should set focus on the 'Back to Home' button when rendered", (assert) => {
let done = assert.async();
MithrilUtils.mountToFixture(this.defaultComponent);
// Wait for the next tick to allow Mithril to complete rendering
setTimeout(() => {
let button = document.getElementById(Constants.Ids.regionClipCancelButton);
strictEqual(document.activeElement, button, "The 'Back to Home' button should have focus");
done();
}, 0);
});
}
}
(new RegionSelectingPanelTests()).run();