Skip to content

Commit

Permalink
feat(input): add showPicker to input
Browse files Browse the repository at this point in the history
  • Loading branch information
Aykut Saraç committed Sep 20, 2023
1 parent 7c1fd0e commit 6adb0b5
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 0 deletions.
202 changes: 202 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@storybook/web-components": "7.0.18",
"@storybook/web-components-vite": "^7.0.18",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/chai-spies": "^1.0.4",
"@types/estree": "1.0.0",
"@types/prettier": "^2.6.4",
"@typescript-eslint/eslint-plugin": "^6.0.0",
Expand All @@ -103,6 +104,7 @@
"@web/test-runner-playwright": "^0.9.0",
"@web/test-runner-puppeteer": "^0.12.0",
"@webcomponents/webcomponentsjs": "^2.7.0",
"chai-spies": "^1.0.0",
"chromatic": "^6.17.1",
"clean-css": "^5.3.2",
"del": "^6.1.0",
Expand Down
13 changes: 13 additions & 0 deletions src/components/input/bl-input.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { assert, expect, fixture, oneEvent, html, elementUpdated } from "@open-wc/testing";
import spies from "chai-spies";
import BlInput from "./bl-input";

chai.use(spies);

describe("bl-input", () => {
it("is defined", () => {
const el = document.createElement("bl-input");
Expand Down Expand Up @@ -44,6 +47,16 @@ describe("bl-input", () => {
expect(el.shadowRoot?.querySelector("input")?.getAttribute("type")).to.equal("number");
});

it('should call showPicker if "showPicker" is in HTMLInputElement.prototype', async () => {
const el = await fixture<BlInput>(html`<bl-input type="input"></bl-input>`);
const spy = chai.spy.on(el.validationTarget, "showPicker");

el.showPicker();

expect(HTMLInputElement.prototype).to.have.property("showPicker");
expect(spy).to.have.been.called.once;
});

it("should set type password", async () => {
const el = await fixture<BlInput>(html`<bl-input type="password"></bl-input>`);

Expand Down
Loading

0 comments on commit 6adb0b5

Please sign in to comment.