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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bootstrap-input-spinner",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "A Bootstrap 5 plugin to create input spinner elements for number input.",
5
5
  "browser": "./src/InputSpinner.js",
6
6
  "type": "module",
@@ -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"})