bootstrap-input-spinner 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test/TestInputSpinner.js +31 -0
package/package.json
CHANGED
package/test/TestInputSpinner.js
CHANGED
|
@@ -208,6 +208,37 @@ describe("InputSpinner events", () => {
|
|
|
208
208
|
})
|
|
209
209
|
})
|
|
210
210
|
|
|
211
|
+
describe("InputSpinner instance isolation", () => {
|
|
212
|
+
it("stepping one spinner does not fire change on another (regression for #121)", async () => {
|
|
213
|
+
const elA = createInput({value: "5", min: "0", max: "10", step: "1"})
|
|
214
|
+
const elB = createInput({value: "5", min: "0", max: "10", step: "1"})
|
|
215
|
+
new InputSpinner(elA)
|
|
216
|
+
new InputSpinner(elB)
|
|
217
|
+
let a = 0, b = 0
|
|
218
|
+
elA.addEventListener("change", () => a++)
|
|
219
|
+
elB.addEventListener("change", () => b++)
|
|
220
|
+
pressButton(elA.nextElementSibling.querySelector(".btn-increment"))
|
|
221
|
+
await wait()
|
|
222
|
+
assert.equal(a, 1)
|
|
223
|
+
assert.equal(b, 0)
|
|
224
|
+
clear()
|
|
225
|
+
})
|
|
226
|
+
it("stepping one spinner does not fire input on another", async () => {
|
|
227
|
+
const elA = createInput({value: "5", min: "0", max: "10", step: "1"})
|
|
228
|
+
const elB = createInput({value: "5", min: "0", max: "10", step: "1"})
|
|
229
|
+
new InputSpinner(elA)
|
|
230
|
+
new InputSpinner(elB)
|
|
231
|
+
let a = 0, b = 0
|
|
232
|
+
elA.addEventListener("input", () => a++)
|
|
233
|
+
elB.addEventListener("input", () => b++)
|
|
234
|
+
pressButton(elA.nextElementSibling.querySelector(".btn-increment"))
|
|
235
|
+
await wait()
|
|
236
|
+
assert.true(a >= 1)
|
|
237
|
+
assert.equal(b, 0)
|
|
238
|
+
clear()
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
|
|
211
242
|
describe("InputSpinner attribute observation", () => {
|
|
212
243
|
it("reflects min/max changes", async () => {
|
|
213
244
|
const {el} = spin({value: "5", min: "0", max: "10"})
|