Skip to content

Commit 07aaafa

Browse files
committed
- fix failing toggle control unit test
1 parent b7df2e8 commit 07aaafa

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Rock.JavaScript.Obsidian/Tests/Controls/toggle.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import JavaScriptAnchor from "../../Framework/Controls/javaScriptAnchor.obs";
44
import assert = require("assert");
55

66
describe("Toggle", () => {
7+
const offButtonIndex = 0;
8+
const onButtonIndex = 1;
9+
710
it("should show default css on ON BUTTON active if no onButtonActiveCssClass prop provided", () => {
811
const wrapper = mount(Toggle, {
912
props: {
@@ -13,7 +16,7 @@ describe("Toggle", () => {
1316
falseText: "FalseText"
1417
}
1518
});
16-
const onButton = wrapper.findAllComponents(JavaScriptAnchor)[0];
19+
const onButton = wrapper.findAllComponents(JavaScriptAnchor)[onButtonIndex];
1720
assert.deepStrictEqual(onButton.classes(), ["active", "btn", "btn-primary"]);
1821
});
1922

@@ -26,7 +29,7 @@ describe("Toggle", () => {
2629
falseText: "FalseText"
2730
}
2831
});
29-
const offButton = wrapper.findAllComponents(JavaScriptAnchor)[1];
32+
const offButton = wrapper.findAllComponents(JavaScriptAnchor)[offButtonIndex];
3033
assert.deepStrictEqual(offButton.classes(), ["active", "btn", "btn-primary"]);
3134
});
3235

@@ -40,7 +43,7 @@ describe("Toggle", () => {
4043
onButtonActiveCssClass: "btn-success"
4144
}
4245
});
43-
const onButton = wrapper.findAllComponents(JavaScriptAnchor)[0];
46+
const onButton = wrapper.findAllComponents(JavaScriptAnchor)[onButtonIndex];
4447
assert.deepStrictEqual(onButton.classes(), ["active", "btn", "btn-primary", "btn-success"]);
4548
});
4649

@@ -54,7 +57,7 @@ describe("Toggle", () => {
5457
offButtonActiveCssClass: "btn-warning"
5558
}
5659
});
57-
const offButton = wrapper.findAllComponents(JavaScriptAnchor)[1];
60+
const offButton = wrapper.findAllComponents(JavaScriptAnchor)[offButtonIndex];
5861
assert.deepStrictEqual(offButton.classes(), ["active", "btn", "btn-primary", "btn-warning"]);
5962
});
6063
});

0 commit comments

Comments
 (0)