refactor: lint
This commit is contained in:
@@ -2,25 +2,30 @@
|
||||
<div class="flex-col">
|
||||
<div class="show-on-large-screen">
|
||||
<input
|
||||
v-model="message"
|
||||
:aria-label="$t('label')"
|
||||
type="text"
|
||||
autofocus
|
||||
v-model="message"
|
||||
:placeholder="$t('paste_a_note')"
|
||||
@keyup.enter="formPost"
|
||||
class="rounded-t-lg"
|
||||
@keyup.enter="formPost"
|
||||
/>
|
||||
</div>
|
||||
<div class="border-b show-on-large-screen border-brdColor">
|
||||
<input
|
||||
v-model="label"
|
||||
:aria-label="$t('label')"
|
||||
type="text"
|
||||
autofocus
|
||||
v-model="label"
|
||||
:placeholder="$t('label')"
|
||||
@keyup.enter="formPost"
|
||||
/>
|
||||
<button class="icon" :disabled="!(this.message || this.label)" value="Save" @click="formPost">
|
||||
<button
|
||||
class="icon"
|
||||
:disabled="!(message || label)"
|
||||
value="Save"
|
||||
@click="formPost"
|
||||
>
|
||||
<i class="material-icons">add</i>
|
||||
<span>Add</span>
|
||||
</button>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<button class="icon" @click="logout" v-close-popover>
|
||||
<button v-close-popover class="icon" @click="logout">
|
||||
<i class="material-icons">exit_to_app</i>
|
||||
<span>{{ $t("logout") }}</span>
|
||||
</button>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import feeds from "../Feeds"
|
||||
import { shallowMount } from "@vue/test-utils"
|
||||
import feeds from "../Feeds"
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
jest.mock("~/helpers/fb", () => ({
|
||||
__esModule: true,
|
||||
@@ -27,8 +29,6 @@ jest.mock("~/helpers/fb", () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
const factory = () =>
|
||||
shallowMount(feeds, {
|
||||
mocks: {
|
||||
@@ -53,7 +53,9 @@ describe("feeds", () => {
|
||||
test("renders all the current feeds", () => {
|
||||
const wrapper = factory()
|
||||
|
||||
expect(wrapper.findAll("div[data-test='list-item']").wrappers).toHaveLength(4)
|
||||
expect(wrapper.findAll("div[data-test='list-item']").wrappers).toHaveLength(
|
||||
4
|
||||
)
|
||||
})
|
||||
|
||||
test("feeds with no label displays the 'no_label' message", () => {
|
||||
@@ -63,7 +65,7 @@ describe("feeds", () => {
|
||||
wrapper
|
||||
.findAll("label[data-test='list-label']")
|
||||
.wrappers.map((e) => e.text())
|
||||
.filter((text) => text == "no_label")
|
||||
.filter((text) => text === "no_label")
|
||||
).toHaveLength(2)
|
||||
})
|
||||
|
||||
@@ -74,30 +76,28 @@ describe("feeds", () => {
|
||||
wrapper
|
||||
.findAll("li[data-test='list-message']")
|
||||
.wrappers.map((e) => e.text())
|
||||
.filter((text) => text == "empty")
|
||||
.filter((text) => text === "empty")
|
||||
).toHaveLength(2)
|
||||
})
|
||||
|
||||
test("labels in the list are proper", () => {
|
||||
const wrapper = factory()
|
||||
|
||||
expect(wrapper.findAll("label[data-test='list-label']").wrappers.map((e) => e.text())).toEqual([
|
||||
"First",
|
||||
"Second",
|
||||
"no_label",
|
||||
"no_label",
|
||||
])
|
||||
expect(
|
||||
wrapper
|
||||
.findAll("label[data-test='list-label']")
|
||||
.wrappers.map((e) => e.text())
|
||||
).toEqual(["First", "Second", "no_label", "no_label"])
|
||||
})
|
||||
|
||||
test("messages in the list are proper", () => {
|
||||
const wrapper = factory()
|
||||
|
||||
expect(wrapper.findAll("li[data-test='list-message']").wrappers.map((e) => e.text())).toEqual([
|
||||
"First Message",
|
||||
"empty",
|
||||
"Third Message",
|
||||
"empty",
|
||||
])
|
||||
expect(
|
||||
wrapper
|
||||
.findAll("li[data-test='list-message']")
|
||||
.wrappers.map((e) => e.text())
|
||||
).toEqual(["First Message", "empty", "Third Message", "empty"])
|
||||
})
|
||||
|
||||
test("clicking on the delete button deletes the feed", async () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import inputform from "../Inputform"
|
||||
import { shallowMount } from "@vue/test-utils"
|
||||
import inputform from "../Inputform"
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
jest.mock("~/helpers/fb", () => ({
|
||||
__esModule: true,
|
||||
@@ -9,8 +11,6 @@ jest.mock("~/helpers/fb", () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
const factory = () =>
|
||||
shallowMount(inputform, {
|
||||
mocks: {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import logout from "../Logout"
|
||||
import { shallowMount, createLocalVue } from "@vue/test-utils"
|
||||
import logout from "../Logout"
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
jest.mock("~/helpers/fb", () => ({
|
||||
__esModule: true,
|
||||
@@ -9,8 +11,6 @@ jest.mock("~/helpers/fb", () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import { fb } from "~/helpers/fb"
|
||||
|
||||
const $toast = {
|
||||
info: jest.fn(),
|
||||
show: jest.fn(),
|
||||
@@ -53,7 +53,9 @@ describe("logout", () => {
|
||||
})
|
||||
|
||||
test("failed signout request fires a error toast", async () => {
|
||||
fb.signOutUser.mockImplementationOnce(() => Promise.reject("test reject"))
|
||||
fb.signOutUser.mockImplementationOnce(() =>
|
||||
Promise.reject(new Error("test reject"))
|
||||
)
|
||||
|
||||
const wrapper = factory()
|
||||
const button = wrapper.find("button")
|
||||
|
||||
Reference in New Issue
Block a user