Experiments (#1174)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Liyas Thomas
2020-09-18 08:58:11 +05:30
committed by GitHub
parent 4ea60d3431
commit b7a44ab11f
7 changed files with 206 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
import urlField from "../url-field"
import { mount } from "@vue/test-utils"
const factory = (props) =>
mount(urlField, {
propsData: props,
})
/*
* NOTE : jsdom as of yet doesn't support contenteditable features
* hence, the test suite is pretty limited as it is not easy to test
* inputting values.
*/
describe("url-field", () => {
test("mounts properly", () => {
const wrapper = factory({
value: "test",
})
expect(wrapper.vm).toBeTruthy()
})
test("highlights environment variables", () => {
const wrapper = factory({
value: "https://hoppscotch.io/<<testa>>/<<testb>>",
})
const highlights = wrapper.findAll(".highlight-VAR").wrappers
expect(highlights).toHaveLength(2)
expect(highlights[0].text()).toEqual("<<testa>>")
expect(highlights[1].text()).toEqual("<<testb>>")
})
})