-
Notifications
You must be signed in to change notification settings - Fork 173
/
v-box-layout.spec.js
38 lines (32 loc) · 1.11 KB
/
v-box-layout.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { screen } from "@testing-library/vue"
import { getAudioObj } from "~~/test/unit/fixtures/audio"
import { render } from "~~/test/unit/test-utils/render"
import VBoxLayout from "~/components/VAudioTrack/layouts/VBoxLayout.vue"
describe("VBoxLayout", () => {
let options = null
let props = {
audio: getAudioObj(),
size: "m",
}
beforeEach(() => {
options = { props }
})
it("renders audio title, license and category in v-box-layout", async () => {
props.audio.category = "music"
await render(VBoxLayout, options)
const title = screen.getByText(props.audio.title)
expect(title).toBeVisible()
const license = screen.getByLabelText(
"Attribution-NonCommercial-Share-Alike"
)
expect(license).toBeInTheDocument() // Not visible unless hovered
const category = screen.getByText("Music")
expect(category).toBeVisible()
})
it("should not render category string if category is null", async () => {
props.audio.category = null
await render(VBoxLayout, options)
const categoryLabel = screen.queryByText("Music")
expect(categoryLabel).toBeNull()
})
})