-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,207 additions
and
1,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "./src/style.css"; | ||
export {version} from "./package.json"; | ||
export * from "./src/index.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import assert from "assert"; | ||
import * as Inputs from "@observablehq/inputs"; | ||
import tape from "./jsdom.js"; | ||
import it from "./jsdom.js"; | ||
|
||
tape("Inputs.bind(button, button) dispatches click events", test => { | ||
it("Inputs.bind(button, button) dispatches click events", () => { | ||
const b1 = document.createElement("button"); | ||
const b2 = Inputs.bind(document.createElement("button"), b1, new Promise(() => {})); | ||
let clicked = false; | ||
b1.addEventListener("click", () => void (clicked = true), {once: true}); | ||
b2.dispatchEvent(new Event("click")); | ||
test.equal(clicked, true); | ||
assert.strictEqual(clicked, true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import * as Inputs from "@observablehq/inputs"; | ||
import tape from "./jsdom.js"; | ||
import assert from "assert"; | ||
import it from "./jsdom.js"; | ||
|
||
tape("Inputs.checkbox([]) handles empty options", test => { | ||
it("Inputs.checkbox([]) handles empty options", () => { | ||
const r = Inputs.checkbox([]); | ||
test.deepEqual(r.value, []); | ||
test.strictEqual(r.value, r.value); | ||
assert.deepStrictEqual(r.value, []); | ||
assert.strictEqual(r.value, r.value); | ||
r.value = ["red"]; | ||
test.deepEqual(r.value, []); | ||
test.strictEqual(r.value, r.value); | ||
assert.deepStrictEqual(r.value, []); | ||
assert.strictEqual(r.value, r.value); | ||
}); | ||
|
||
tape("Inputs.checkbox([value]) handles singular option", test => { | ||
it("Inputs.checkbox([value]) handles singular option", () => { | ||
const r = Inputs.checkbox(["red"]); | ||
test.deepEqual(r.value, []); | ||
test.strictEqual(r.value, r.value); | ||
assert.deepStrictEqual(r.value, []); | ||
assert.strictEqual(r.value, r.value); | ||
r.value = ["blue"]; | ||
test.deepEqual(r.value, []); | ||
assert.deepStrictEqual(r.value, []); | ||
r.value = ["red"]; | ||
test.deepEqual(r.value, ["red"]); | ||
test.strictEqual(r.value, r.value); | ||
assert.deepStrictEqual(r.value, ["red"]); | ||
assert.strictEqual(r.value, r.value); | ||
r.value = ["blue"]; | ||
test.deepEqual(r.value, []); | ||
assert.deepStrictEqual(r.value, []); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.