1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-29 14:35:35 +03:00

Fixed front test pulled

This commit is contained in:
willbasky 2019-11-02 10:37:27 +05:00
commit e5c99eb43b
5 changed files with 63 additions and 19 deletions

View File

@ -90,7 +90,7 @@ export default class AddItemDialog extends Vue {
isValid: boolean = false
// TODO create mixin or external dialog component which reset data on new open,
// cause this code is duplicated in another dialog components (AddCategoryDialog)
// cause this code is duplicated in another dialog components (AddCategoryDialog, CategorySettingsDialog)
@Watch('value')
onOpen () {
this.name = ''

View File

@ -54,7 +54,7 @@
hide-details
color="info"
class="category-settings-dialog__checkbox"
data-testid="CategorySettings-ItemTraitsSectionCheckbox"
:data-testid="section.dataTestId"
:label="section.name"
:value="section.value"
:inputValue="sections"
@ -106,11 +106,17 @@ const categorySectionNames = {
[CategorySection.notes]: 'Notes section'
}
const categorySectionDataTestId = {
[CategorySection.prosCons]: 'CategorySettings-ItemTraitsSectionCheckbox',
[CategorySection.ecosystem]: 'CategorySettings-ItemEcosystemSectionCheckbox',
[CategorySection.notes]: 'CategorySettings-ItemNotesSectionCheckbox'
}
const categoryStatuses = Object.entries(categoryStatusNames)
.map(([value, name]) => ({ value, name }))
const categorySections = Object.entries(categorySectionNames)
.map(([value, name]) => ({ value, name }))
.map(([value, name]) => ({ value, name, dataTestId: categorySectionDataTestId[value] }))
@Component({
// categoryStatuses, categorySections is here to use in template but without reactivity

View File

@ -0,0 +1,47 @@
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faPlus,
faCog,
faTrashAlt,
faArrowUp,
faArrowDown,
faEllipsisV,
faRss,
faBars,
faLink,
faCircle,
faTimes,
faSearch,
faCaretDown,
faPen,
faExclamationTriangle,
} from '@fortawesome/free-solid-svg-icons'
import { faSquare, faCheckSquare } from '@fortawesome/free-regular-svg-icons'
// This is for vuetify v-checkbox, v-select components, which uses by default icons with such names
faCheckSquare.iconName = 'checkboxOn'
faSquare.iconName = 'checkboxOff'
faCaretDown.iconName = 'dropdown'
const icons = [
faPlus,
faCog,
faTrashAlt,
faArrowUp,
faArrowDown,
faEllipsisV,
faRss,
faBars,
faLink,
faCircle,
faTimes,
faSearch,
faCaretDown,
faPen,
faExclamationTriangle,
faSquare,
faCheckSquare
]
library.add(...icons)
export default icons

View File

@ -1,34 +1,24 @@
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { library } from '@fortawesome/fontawesome-svg-core'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { faSquare, faCheckSquare } from '@fortawesome/free-regular-svg-icons'
library.add(fas, faSquare, faCheckSquare)
import icons from 'client/icons'
const icons = {}
const addIcon = ({ prefix, iconName }, iconUsageName = iconName) => {
icons[iconUsageName] = {
const vuetifyIcons = {}
const addIcon = ({ prefix, iconName }) => {
vuetifyIcons[iconName] = {
component: 'font-awesome-icon',
props: {
icon: [prefix, iconName]
}
}
}
// TODO import and add only used icons for production
Object.values({ ...fas, faSquare, faCheckSquare }).forEach(x => addIcon(x))
// This is for vuetify v-checkbox, v-select components, which uses by default icons with such names
addIcon(faCheckSquare, 'checkboxOn')
addIcon(faSquare, 'checkboxOff')
addIcon(fas.faCaretDown, 'dropdown')
icons.forEach(addIcon)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(Vuetify)
export default new Vuetify({
icons: {
values: icons
values: vuetifyIcons
}
})

View File

@ -7,6 +7,7 @@ fixture`Index`
// sometimes it takes long for index page to load and tests can fail
await t.wait(2000)
})
// TODO add hook that checks for console errors on each test and fail if errors exist
test('Resize window if mobile test', testFunctions.resizeWindowIfMobile)
test('Create category, create category with duplicate name', testFunctions.createCategoryAndDuplicate)