-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): prevent
CoreHtml
issue with invlid attributes
- Loading branch information
Showing
3 changed files
with
83 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import CoreHtml from "./CoreHtml.vue"; | ||
import { flushPromises, mount } from "@vue/test-utils"; | ||
import injectionKeys from "@/injectionKeys"; | ||
import { ref } from "vue"; | ||
import { mockProvides } from "@/tests/mocks"; | ||
|
||
describe("CoreCheckboxInput", () => { | ||
it("should filter invalid Attributes props", async () => { | ||
const wrapper = mount(CoreHtml, { | ||
slots: { | ||
default: "slot", | ||
}, | ||
global: { | ||
provide: { | ||
...mockProvides, | ||
[injectionKeys.evaluatedFields as symbol]: { | ||
htmlInside: ref("inside"), | ||
element: ref("div"), | ||
styles: ref({ | ||
color: "red", | ||
}), | ||
attrs: ref({ | ||
"0invalid": "invalid", | ||
valid: "valid", | ||
}), | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
await flushPromises(); | ||
|
||
const attrs = wrapper.attributes(); | ||
|
||
expect(attrs.valid).toBe("valid"); | ||
expect(attrs.invalid).toBeUndefined(); | ||
expect(attrs.style).toBe("color: red;"); | ||
|
||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
}); |
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
17 changes: 17 additions & 0 deletions
17
src/ui/src/components/core/other/__snapshots__/CoreHtml.spec.ts.snap
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,17 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CoreCheckboxInput > should filter invalid Attributes props 1`] = ` | ||
<div | ||
class="CoreHTML" | ||
data-writer-container="" | ||
style="color: red;" | ||
valid="valid" | ||
> | ||
slot | ||
<div> | ||
inside | ||
</div> | ||
</div> | ||
`; |