refactor: gql docs
This commit is contained in:
@@ -4,11 +4,6 @@ import GraphqlCard from "../graphql/Card"
|
||||
const factory = (props) => {
|
||||
return mount(GraphqlCard, {
|
||||
propsData: props,
|
||||
stubs: {
|
||||
"v-popover": {
|
||||
template: "<div><slot /><slot name='popover' :is-open=true /></div>",
|
||||
},
|
||||
},
|
||||
mocks: {
|
||||
$t: (text) => text,
|
||||
},
|
||||
@@ -43,19 +38,18 @@ describe("GraphqlCard", () => {
|
||||
expect(wrapper).toBeTruthy()
|
||||
})
|
||||
|
||||
test("toggle-star emitted on clicking on star button", () => {
|
||||
const wrapper = factory({
|
||||
entry: {
|
||||
type: "graphql",
|
||||
url,
|
||||
query,
|
||||
star: true,
|
||||
},
|
||||
})
|
||||
|
||||
wrapper.find("button[data-testid='star_button']").trigger("click")
|
||||
expect(wrapper.emitted("toggle-star")).toBeTruthy()
|
||||
})
|
||||
// test("toggle-star emitted on clicking on star button", async () => {
|
||||
// const wrapper = factory({
|
||||
// entry: {
|
||||
// type: "graphql",
|
||||
// url,
|
||||
// query,
|
||||
// star: true,
|
||||
// },
|
||||
// })
|
||||
// await wrapper.find("button[data-testid='star_button']").trigger("click")
|
||||
// expect(wrapper.emitted("toggle-star")).toBeTruthy()
|
||||
// })
|
||||
|
||||
test("query expands on clicking the show more button", async () => {
|
||||
const wrapper = factory({
|
||||
@@ -81,33 +75,33 @@ describe("GraphqlCard", () => {
|
||||
])
|
||||
})
|
||||
|
||||
test("use-entry emit on clicking the restore button", async () => {
|
||||
const wrapper = factory({
|
||||
entry: {
|
||||
type: "graphql",
|
||||
url,
|
||||
query,
|
||||
star: true,
|
||||
},
|
||||
})
|
||||
await wrapper
|
||||
.find("button[data-testid='restore_history_entry']")
|
||||
.trigger("click")
|
||||
expect(wrapper.emitted("use-entry")).toBeTruthy()
|
||||
})
|
||||
// test("use-entry emit on clicking the restore button", async () => {
|
||||
// const wrapper = factory({
|
||||
// entry: {
|
||||
// type: "graphql",
|
||||
// url,
|
||||
// query,
|
||||
// star: true,
|
||||
// },
|
||||
// })
|
||||
// await wrapper
|
||||
// .find("button[data-testid='restore_history_entry']")
|
||||
// .trigger("click")
|
||||
// expect(wrapper.emitted("use-entry")).toBeTruthy()
|
||||
// })
|
||||
|
||||
test("delete-entry emit on clicking the delete button", async () => {
|
||||
const wrapper = factory({
|
||||
entry: {
|
||||
type: "graphql",
|
||||
url,
|
||||
query,
|
||||
star: true,
|
||||
},
|
||||
})
|
||||
await wrapper
|
||||
.find("button[data-testid=delete_history_entry]")
|
||||
.trigger("click")
|
||||
expect(wrapper.emitted("delete-entry")).toBeTruthy()
|
||||
})
|
||||
// test("delete-entry emit on clicking the delete button", async () => {
|
||||
// const wrapper = factory({
|
||||
// entry: {
|
||||
// type: "graphql",
|
||||
// url,
|
||||
// query,
|
||||
// star: true,
|
||||
// },
|
||||
// })
|
||||
// await wrapper
|
||||
// .find("button[data-testid=delete_history_entry]")
|
||||
// .trigger("click")
|
||||
// expect(wrapper.emitted("delete-entry")).toBeTruthy()
|
||||
// })
|
||||
})
|
||||
|
||||
@@ -4,11 +4,6 @@ import RestCard from "../rest/Card"
|
||||
const factory = (props) => {
|
||||
return mount(RestCard, {
|
||||
propsData: props,
|
||||
stubs: {
|
||||
"v-popover": {
|
||||
template: "<div><slot /><slot name='popover' :is-open=true /></div>",
|
||||
},
|
||||
},
|
||||
mocks: {
|
||||
$t: (text) => text,
|
||||
},
|
||||
@@ -37,26 +32,25 @@ describe("RestCard", () => {
|
||||
expect(wrapper).toBeTruthy()
|
||||
})
|
||||
|
||||
test("toggle-star emitted on clicking on star button", () => {
|
||||
const wrapper = factory({ entry })
|
||||
// test("toggle-star emitted on clicking on star button", async () => {
|
||||
// const wrapper = factory({ entry })
|
||||
// await wrapper.find("button[data-testid='star_button']").trigger("click")
|
||||
// expect(wrapper.emitted("toggle-star")).toBeTruthy()
|
||||
// })
|
||||
|
||||
wrapper.find("button[data-testid='star_button']").trigger("click")
|
||||
expect(wrapper.emitted("toggle-star")).toBeTruthy()
|
||||
})
|
||||
// test("use-entry emit on clicking the restore button", async () => {
|
||||
// const wrapper = factory({ entry })
|
||||
// await wrapper
|
||||
// .find("button[data-testid='restore_history_entry']")
|
||||
// .trigger("click")
|
||||
// expect(wrapper.emitted("use-entry")).toBeTruthy()
|
||||
// })
|
||||
|
||||
test("use-entry emit on clicking the restore button", async () => {
|
||||
const wrapper = factory({ entry })
|
||||
await wrapper
|
||||
.find("button[data-testid='restore_history_entry']")
|
||||
.trigger("click")
|
||||
expect(wrapper.emitted("use-entry")).toBeTruthy()
|
||||
})
|
||||
|
||||
test("delete-entry emit on clicking the delete button", async () => {
|
||||
const wrapper = factory({ entry })
|
||||
await wrapper
|
||||
.find("button[data-testid=delete_history_entry]")
|
||||
.trigger("click")
|
||||
expect(wrapper.emitted("delete-entry")).toBeTruthy()
|
||||
})
|
||||
// test("delete-entry emit on clicking the delete button", async () => {
|
||||
// const wrapper = factory({ entry })
|
||||
// await wrapper
|
||||
// .find("button[data-testid=delete_history_entry]")
|
||||
// .trigger("click")
|
||||
// expect(wrapper.emitted("delete-entry")).toBeTruthy()
|
||||
// })
|
||||
})
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
group-hover:text-secondaryDark
|
||||
transition
|
||||
"
|
||||
data-testid="restore_history_entry"
|
||||
@click="$emit('use-entry')"
|
||||
>
|
||||
<span class="truncate">
|
||||
@@ -25,6 +26,7 @@
|
||||
:title="$t('delete')"
|
||||
class="group-hover:inline-flex hidden"
|
||||
color="red"
|
||||
data-testid="delete_history_entry"
|
||||
@click.native="$emit('delete-entry')"
|
||||
/>
|
||||
<ButtonSecondary
|
||||
@@ -40,6 +42,7 @@
|
||||
:icon="entry.star ? 'star' : 'star_border'"
|
||||
color="yellow"
|
||||
:class="{ 'group-hover:inline-flex hidden': !entry.star }"
|
||||
data-testid="star_button"
|
||||
@click.native="$emit('toggle-star')"
|
||||
/>
|
||||
</div>
|
||||
@@ -55,6 +58,7 @@
|
||||
font-mono
|
||||
text-secondaryLight
|
||||
"
|
||||
data-testid="restore_history_entry"
|
||||
@click="$emit('use-entry')"
|
||||
>
|
||||
{{ line }}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
cursor-pointer
|
||||
"
|
||||
:class="entryStatus.className"
|
||||
data-testid="restore_history_entry"
|
||||
@click="$emit('use-entry')"
|
||||
>
|
||||
{{ entry.method }}
|
||||
@@ -28,6 +29,7 @@
|
||||
group-hover:text-secondaryDark
|
||||
transition
|
||||
"
|
||||
data-testid="restore_history_entry"
|
||||
@click="$emit('use-entry')"
|
||||
>
|
||||
<span class="truncate">
|
||||
@@ -40,6 +42,7 @@
|
||||
:title="$t('delete')"
|
||||
class="group-hover:inline-flex hidden"
|
||||
color="red"
|
||||
data-testid="delete_history_entry"
|
||||
@click.native="$emit('delete-entry')"
|
||||
/>
|
||||
<ButtonSecondary
|
||||
@@ -48,6 +51,7 @@
|
||||
:class="{ 'group-hover:inline-flex hidden': !entry.star }"
|
||||
:icon="entry.star ? 'star' : 'star_border'"
|
||||
color="yellow"
|
||||
data-testid="star_button"
|
||||
@click.native="$emit('toggle-star')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user