-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9783f9e
commit d0043af
Showing
28 changed files
with
1,338 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
docs/.vuepress/theme/components/__tests__/DropdownLink.spec.js
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,68 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import DropdownLink from "@/theme/components/DropdownLink" | ||
|
||
describe('DropdownLink', () => { | ||
test('render successfully for non-languages', () => { | ||
const wrapper = shallowMount(DropdownLink, { | ||
propsData: { | ||
item: { | ||
text: "choices", | ||
items: [{ | ||
text: "currency", | ||
link: "http://currency.com", | ||
type: "links", | ||
items: [{ | ||
text: "USD", | ||
link: "http://currency.com/USD" | ||
}, { | ||
text: "BTC", | ||
link: "http://currency.com/BTC" | ||
} | ||
]}, { | ||
text: "planet", | ||
link: "http://planets.com", | ||
type: "images" | ||
}, { | ||
text: "color", | ||
link: "http://colors.com", | ||
type: "links", | ||
items: [{ | ||
text: "red", | ||
link: "http://color.com/red" | ||
}, { | ||
text: "blue", | ||
link: "http://color.com/blue" | ||
}, { | ||
text: "green", | ||
link: "http://color.com/blue" | ||
} | ||
] | ||
}] | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render successfully for languages', () => { | ||
const wrapper = shallowMount(DropdownLink, { | ||
propsData: { | ||
item: { | ||
text: "Languages", | ||
items: [{ | ||
text: "English", | ||
link: "en" | ||
}, { | ||
text: "Deutsch", | ||
link: "de", | ||
}, { | ||
text: "Italiano", | ||
link: "it" | ||
}] | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
}) |
9 changes: 9 additions & 0 deletions
9
docs/.vuepress/theme/components/__tests__/DropdownTransition.spec.js
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,9 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import DropdownTransition from "@/theme/components/DropdownTransition" | ||
|
||
describe('DropdownTransition', () => { | ||
test('render successfully', () => { | ||
const wrapper = shallowMount(DropdownTransition) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import Footer from "@/theme/components/Footer" | ||
|
||
describe('Footer', () => { | ||
test('render successfully', () => { | ||
const wrapper = shallowMount(Footer) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import Header from "@/theme/components/Header" | ||
|
||
describe('Header', () => { | ||
test('render successfully', () => { | ||
const wrapper = shallowMount(Header, { | ||
mocks: { | ||
$site: { | ||
themeConfig: { | ||
search: true | ||
} | ||
} | ||
} | ||
}) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import Hero from "@/theme/components/Hero" | ||
|
||
describe('Hero', () => { | ||
test('dark mode', () => { | ||
const wrapper = shallowMount(Hero, { | ||
propsData: { | ||
dark: true | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('light mode', () => { | ||
const wrapper = shallowMount(Hero, { | ||
propsData: { | ||
dark: false | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) | ||
|
68 changes: 68 additions & 0 deletions
68
docs/.vuepress/theme/components/__tests__/LanguageDropdown.spec.js
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,68 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import LanguageDropdown from "@/theme/components/LanguageDropdown" | ||
|
||
describe('LanguageDropdown', () => { | ||
test('render with locales', () => { | ||
const wrapper = shallowMount(LanguageDropdown, { | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"en": { | ||
label: "English", | ||
lang: "en" | ||
}, | ||
"de": { | ||
label: "Deutsch", | ||
lang: "de" | ||
} | ||
}, | ||
}, | ||
$lang: "ko", | ||
$page: { | ||
path: "/en" | ||
}, | ||
$localeConfig: { | ||
path: "en" | ||
}, | ||
$router: { | ||
options: { | ||
routes: [{ | ||
path: "/en" | ||
}, { | ||
path: "/de" | ||
}] | ||
} | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render without locales', () => { | ||
const wrapper = shallowMount(LanguageDropdown, { | ||
mocks: { | ||
$site: { | ||
locales: { | ||
}, | ||
}, | ||
$lang: "ko", | ||
$page: { | ||
path: "/en" | ||
}, | ||
$localeConfig: { | ||
path: "en" | ||
}, | ||
$router: { | ||
options: { | ||
routes: [{ | ||
path: "/en" | ||
}, { | ||
path: "/de" | ||
}] | ||
} | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
docs/.vuepress/theme/components/__tests__/LanguageIcon.spec.js
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,10 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import LanguageIcon from "@/theme/components/LanguageIcon" | ||
|
||
describe('LanguageIcon', () => { | ||
test('render successfully', () => { | ||
const wrapper = shallowMount(LanguageIcon) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import NavLink from "@/theme/components/NavLink" | ||
|
||
describe('NavLink', () => { | ||
test('render as external link', () => { | ||
const wrapper = shallowMount(NavLink, { | ||
propsData: { | ||
item: { | ||
text: "external link", | ||
link: "https://google.com" | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render as email', () => { | ||
const wrapper = shallowMount(NavLink, { | ||
propsData: { | ||
item: { | ||
text: "email", | ||
link: "mailto:abc@google.com" | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render as tel', () => { | ||
const wrapper = shallowMount(NavLink, { | ||
propsData: { | ||
item: { | ||
text: "tel", | ||
link: "tel:1778901652" | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render as link with locales', () => { | ||
const wrapper = shallowMount(NavLink, { | ||
propsData: { | ||
item: { | ||
text: "English", | ||
link: "en" | ||
} | ||
}, | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"en": { | ||
label: "English", | ||
lang: "en" | ||
}, | ||
"de": { | ||
label: "Deutsch", | ||
lang: "de" | ||
} | ||
}, | ||
} | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) |
84 changes: 84 additions & 0 deletions
84
docs/.vuepress/theme/components/__tests__/NavLinks.spec.js
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,84 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import NavLinks from "@/theme/components/NavLinks" | ||
|
||
describe('NavLinks', () => { | ||
test('render as sidebar, with no navigation', () => { | ||
const wrapper = shallowMount(NavLinks, { | ||
propsData: { | ||
isSidebar: true | ||
}, | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"/": {} | ||
}, | ||
}, | ||
$lang: "en-US" | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render as sidebar, with navigation', () => { | ||
const wrapper = shallowMount(NavLinks, { | ||
propsData: { | ||
isSidebar: true | ||
}, | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"/": { | ||
nav: ["en"] | ||
}, | ||
"/de/": { | ||
nav: "de" | ||
} | ||
}, | ||
}, | ||
$lang: "en-US" | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render as sidebar, with navigation and sub-items', () => { | ||
const wrapper = shallowMount(NavLinks, { | ||
propsData: { | ||
isSidebar: true | ||
}, | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"/": { | ||
nav: [{ | ||
items: ["en-US", "en-GB"] | ||
}] | ||
}, | ||
"/de/": { | ||
nav: "de" | ||
} | ||
}, | ||
}, | ||
$lang: "en-US" | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('render not as sidebar', () => { | ||
const wrapper = shallowMount(NavLinks, { | ||
propsData: { | ||
isSidebar: false | ||
}, | ||
mocks: { | ||
$site: { | ||
locales: { | ||
"/": {} | ||
}, | ||
}, | ||
$lang: "en-US" | ||
} | ||
}) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) |
17 changes: 17 additions & 0 deletions
17
docs/.vuepress/theme/components/__tests__/SearchBox.spec.js
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 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import SearchBox from "@/theme/components/SearchBox" | ||
|
||
describe('SearchBox', () => { | ||
test('render searchbox', () => { | ||
const wrapper = shallowMount(SearchBox) | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
|
||
test('searchbox suggest', () => { | ||
const wrapper = shallowMount(SearchBox) | ||
wrapper.find("input[aria-label]").setValue("eth") | ||
wrapper.find("input[aria-label]").trigger("keyup.enter") | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) | ||
|
Oops, something went wrong.