mirror of https://github.com/halo-dev/halo
test: add input component test case
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/3445/head
parent
fa0084e0de
commit
ee0fa26c8b
|
@ -1,8 +1,20 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { VInput } from "../index";
|
||||
import { mount } from "@vue/test-utils";
|
||||
|
||||
describe("Input", () => {
|
||||
it("should render", () => {
|
||||
expect(VInput).toBeDefined();
|
||||
expect(mount(VInput).html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should work with size prop", function () {
|
||||
["lg", "md", "sm", "xs"].forEach((size) => {
|
||||
const input = mount(VInput, { props: { size } });
|
||||
|
||||
expect(input.html()).toMatchSnapshot();
|
||||
expect(input.find("input").classes()).toContain(`input-${size}`);
|
||||
input.unmount();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,3 +6,31 @@ exports[`Input > should render 1`] = `
|
|||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`Input > should work with size prop 1`] = `
|
||||
"<div class=\\"input-wrapper\\">
|
||||
<!--v-if--><input class=\\"input-lg\\" type=\\"text\\">
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`Input > should work with size prop 2`] = `
|
||||
"<div class=\\"input-wrapper\\">
|
||||
<!--v-if--><input class=\\"input-md\\" type=\\"text\\">
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`Input > should work with size prop 3`] = `
|
||||
"<div class=\\"input-wrapper\\">
|
||||
<!--v-if--><input class=\\"input-sm\\" type=\\"text\\">
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`Input > should work with size prop 4`] = `
|
||||
"<div class=\\"input-wrapper\\">
|
||||
<!--v-if--><input class=\\"input-xs\\" type=\\"text\\">
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
|
|
Loading…
Reference in New Issue