mirror of https://github.com/halo-dev/halo-admin
test: add input component test case
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/581/head
parent
5975d9d607
commit
28ea197230
|
@ -1,8 +1,20 @@
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { VInput } from "../index";
|
import { VInput } from "../index";
|
||||||
|
import { mount } from "@vue/test-utils";
|
||||||
|
|
||||||
describe("Input", () => {
|
describe("Input", () => {
|
||||||
it("should render", () => {
|
it("should render", () => {
|
||||||
expect(VInput).toBeDefined();
|
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-->
|
<!--v-if-->
|
||||||
</div>"
|
</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