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 isValid: boolean = false
// TODO create mixin or external dialog component which reset data on new open, // 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') @Watch('value')
onOpen () { onOpen () {
this.name = '' this.name = ''

View File

@ -54,7 +54,7 @@
hide-details hide-details
color="info" color="info"
class="category-settings-dialog__checkbox" class="category-settings-dialog__checkbox"
data-testid="CategorySettings-ItemTraitsSectionCheckbox" :data-testid="section.dataTestId"
:label="section.name" :label="section.name"
:value="section.value" :value="section.value"
:inputValue="sections" :inputValue="sections"
@ -106,11 +106,17 @@ const categorySectionNames = {
[CategorySection.notes]: 'Notes section' [CategorySection.notes]: 'Notes section'
} }
const categorySectionDataTestId = {
[CategorySection.prosCons]: 'CategorySettings-ItemTraitsSectionCheckbox',
[CategorySection.ecosystem]: 'CategorySettings-ItemEcosystemSectionCheckbox',
[CategorySection.notes]: 'CategorySettings-ItemNotesSectionCheckbox'
}
const categoryStatuses = Object.entries(categoryStatusNames) const categoryStatuses = Object.entries(categoryStatusNames)
.map(([value, name]) => ({ value, name })) .map(([value, name]) => ({ value, name }))
const categorySections = Object.entries(categorySectionNames) const categorySections = Object.entries(categorySectionNames)
.map(([value, name]) => ({ value, name })) .map(([value, name]) => ({ value, name, dataTestId: categorySectionDataTestId[value] }))
@Component({ @Component({
// categoryStatuses, categorySections is here to use in template but without reactivity // 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 Vue from 'vue'
import Vuetify from 'vuetify/lib' import Vuetify from 'vuetify/lib'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { library } from '@fortawesome/fontawesome-svg-core' import icons from 'client/icons'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { faSquare, faCheckSquare } from '@fortawesome/free-regular-svg-icons'
library.add(fas, faSquare, faCheckSquare)
const icons = {} const vuetifyIcons = {}
const addIcon = ({ prefix, iconName }, iconUsageName = iconName) => { const addIcon = ({ prefix, iconName }) => {
icons[iconUsageName] = { vuetifyIcons[iconName] = {
component: 'font-awesome-icon', component: 'font-awesome-icon',
props: { props: {
icon: [prefix, iconName] icon: [prefix, iconName]
} }
} }
} }
// TODO import and add only used icons for production icons.forEach(addIcon)
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')
Vue.component('font-awesome-icon', FontAwesomeIcon) Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(Vuetify) Vue.use(Vuetify)
export default new Vuetify({ export default new Vuetify({
icons: { 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 // sometimes it takes long for index page to load and tests can fail
await t.wait(2000) 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('Resize window if mobile test', testFunctions.resizeWindowIfMobile)
test('Create category, create category with duplicate name', testFunctions.createCategoryAndDuplicate) test('Create category, create category with duplicate name', testFunctions.createCategoryAndDuplicate)