Skip to content

Commit 266b745

Browse files
author
Arthur Ayvazov
committed
geophystech#137 Убраны все ворнинги связанные с неопределёнными тегами BootstrapVue.
1 parent 23f7223 commit 266b745

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+364
-132
lines changed

test/e2e/custom-assertions/elementCount.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
//
77
// for how to write custom assertions see
88
// http://nightwatchjs.org/guide#writing-custom-assertions
9-
exports.assertion = function (selector, count) {
9+
exports.assertion = function(selector, count)
10+
{
1011
this.message = 'Testing if element <' + selector + '> has count: ' + count
1112
this.expected = count
12-
this.pass = function (val) {
13+
this.pass = function(val) {
1314
return val === this.expected
1415
}
15-
this.value = function (res) {
16+
this.value = function(res) {
1617
return res.value
1718
}
18-
this.command = function (cb) {
19-
var self = this
20-
return this.api.execute(function (selector) {
19+
this.command = function(cb)
20+
{
21+
const self = this
22+
return this.api.execute(function(selector) {
2123
return document.querySelectorAll(selector).length
22-
}, [selector], function (res) {
24+
}, [selector], function(res) {
2325
cb.call(self, res)
2426
})
2527
}

test/unit/specs/Analytics.spec.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import Analytics from '@/components/Analytics'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('Analytics.vue', () => {
711

812
const wrapper = shallowMount(Analytics, {
9-
mocks: {
10-
$http, $moment
11-
}
13+
mocks: { $http, $moment },
14+
localVue
1215
})
1316

1417
it('Check component Analytics', () => {

test/unit/specs/AppFooter.spec.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import AppFooter from '@/components/AppFooter'
3+
import BootstrapVue from 'bootstrap-vue'
34
import AppSettings from '@/settings/app'
45

6+
const localVue = createLocalVue()
7+
localVue.use(BootstrapVue)
8+
59
describe('AppFooter.vue', () => {
610

7-
const wrapper = shallowMount(AppFooter)
11+
const wrapper = shallowMount(AppFooter, {
12+
localVue
13+
})
814

915
it('renders copyright', () => {
1016
const copyright = wrapper.find('#copyright').text()

test/unit/specs/AppHeader.spec.js

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { shallowMount, createLocalVue } from '@vue/test-utils'
2-
32
import AppHeader from '@/components/AppHeader'
3+
import BootstrapVue from 'bootstrap-vue'
44
import VueRouter from 'vue-router'
5+
import { RouterLink } from '../utils'
56

6-
const RouterLink = {
7-
name: 'router-link',
8-
render: function(h) {
9-
return h('a', this.$slots.default)
10-
},
11-
props: ['to']
12-
}
7+
const localVue = createLocalVue()
8+
const router = new VueRouter()
9+
localVue.use(BootstrapVue)
10+
localVue.use(VueRouter)
1311

1412
describe('AppHeader.vue', () => {
1513

@@ -21,10 +19,6 @@ describe('AppHeader.vue', () => {
2119
}
2220
}
2321

24-
const localVue = createLocalVue()
25-
localVue.use(VueRouter)
26-
27-
const router = new VueRouter()
2822
const wrapper = shallowMount(AppHeader, {
2923
localVue,
3024
router,
@@ -78,6 +72,7 @@ describe('AppHeader.vue', () => {
7872
}
7973

8074
const wrapper = shallowMount(AppHeader, {
75+
localVue,
8176
router,
8277
mocks: {
8378
$store
@@ -119,6 +114,7 @@ describe('AppHeader.vue', () => {
119114
}
120115

121116
const wrapper = shallowMount(AppHeader, {
117+
localVue,
122118
router,
123119
mocks: {
124120
$store

test/unit/specs/AppNavbar.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import AppNavbar from '@/components/AppNavbar'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('AppNavbar.vue', () => {
711

812
const wrapper = shallowMount(AppNavbar, {
9-
mocks: { $http, $moment }
13+
mocks: { $http, $moment },
14+
localVue
1015
})
1116

1217
it('Check component AppNavbar', () => {

test/unit/specs/CountersHeader.spec.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import CountersHeader from '@/components/CountersHeader'
3+
import BootstrapVue from 'bootstrap-vue'
4+
import { RouterLink } from '../utils'
35
import $moment from 'moment'
46
import $http from 'axios'
57

8+
const localVue = createLocalVue()
9+
localVue.use(BootstrapVue)
10+
611
describe('CountersHeader.vue', () => {
712

813
const $store = {
@@ -14,7 +19,9 @@ describe('CountersHeader.vue', () => {
1419
}
1520

1621
const wrapper = shallowMount(CountersHeader, {
17-
mocks: { $http, $moment, $store }
22+
mocks: { $http, $moment, $store },
23+
stubs: { RouterLink },
24+
localVue
1825
})
1926

2027
it('Check component CountersHeader', () => {

test/unit/specs/Event.spec.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { shallowMount } from '@vue/test-utils'
2-
import Event from '@/components/Event'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
2+
import { $routerMocks, RouterLink } from '../utils'
33
import EventHeader from '@/components/event/Header'
4+
import BootstrapVue from 'bootstrap-vue'
5+
import Event from '@/components/Event'
46
import $moment from 'moment'
57
import $http from 'axios'
6-
import {$routerMocks} from '../utils'
8+
9+
const localVue = createLocalVue()
10+
localVue.use(BootstrapVue)
711

812
describe('Event.vue', () => {
913

@@ -17,11 +21,13 @@ describe('Event.vue', () => {
1721

1822
const wrapper = shallowMount(Event, {
1923
mocks: Object.assign({ $http, $moment, $store }, $routerMocks),
24+
stubs: { RouterLink },
2025
propsData: {
2126
components: {
2227
header: EventHeader
2328
}
24-
}
29+
},
30+
localVue
2531
})
2632

2733
it('Check component Event', () => {

test/unit/specs/Events.spec.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import Events from '@/components/Events'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('Events.vue', () => {
711

812
const wrapper = shallowMount(Events, {
13+
mocks: { $http, $moment },
914
propsData: {
1015
spinners: {},
1116
events: []
1217
},
13-
mocks: {
14-
$http, $moment
15-
}
18+
localVue
1619
})
1720

1821
it('Check component Events', () => {

test/unit/specs/ExportDropDown.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import ExportDropDown from '@/components/ExportDropDown'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('ExportDropDown.vue', () => {
711

812
const $store = {
@@ -14,7 +18,8 @@ describe('ExportDropDown.vue', () => {
1418
}
1519

1620
const wrapper = shallowMount(ExportDropDown, {
17-
mocks: { $http, $moment, $store }
21+
mocks: { $http, $moment, $store },
22+
localVue
1823
})
1924

2025
it('Check component ExportDropDown', () => {

test/unit/specs/Filters.spec.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import Filters from '@/components/Filters'
3-
import { $routerMocks } from '../utils'
3+
import BootstrapVue from 'bootstrap-vue'
4+
import { $routerMocks, eventFilters } from '../utils'
45
import $moment from 'moment'
56
import $http from 'axios'
67

8+
const localVue = createLocalVue()
9+
localVue.use(BootstrapVue)
10+
711
describe('Filters.vue', () => {
812

913
const $store = {
@@ -15,11 +19,27 @@ describe('Filters.vue', () => {
1519
}
1620

1721
const wrapper = shallowMount(Filters, {
18-
mocks: Object.assign({ $http, $moment, $store }, $routerMocks)
22+
mocks: Object.assign({ $http, $moment, $store }, $routerMocks),
23+
attachToDocument: true,
24+
localVue
1925
})
2026

2127
it('Check component Filters', () => {
2228
expect(wrapper.is(Filters)).to.eql(true)
2329
})
2430

31+
describe('Check filter fields', () => {
32+
33+
for (let item of Object.entries(eventFilters))
34+
{
35+
const [filterName, filterConf] = item
36+
const field = wrapper.find(`${filterConf.tag}[name="${filterName}"]`)
37+
38+
it(`Check filter ${filterName}`, () => {
39+
expect(field.exists()).to.eql(true)
40+
})
41+
}
42+
43+
})
44+
2545
})

test/unit/specs/FlashMessage.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import FlashMessage from '@/components/FlashMessage'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('FlashMessage.vue', () => {
711

812
const wrapper = shallowMount(FlashMessage, {
9-
mocks: { $http, $moment }
13+
mocks: { $http, $moment },
14+
localVue
1015
})
1116

1217
it('Check component FlashMessage', () => {

test/unit/specs/Mainpage.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import Mainpage from '@/components/Mainpage'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('Mainpage.vue', () => {
711

812
const wrapper = shallowMount(Mainpage, {
9-
mocks: { $http, $moment }
13+
mocks: { $http, $moment },
14+
localVue
1015
})
1116

1217
it('Check component Mainpage', () => {

test/unit/specs/MobileAppAlert.spec.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import MobileAppAlert from '@/components/MobileAppAlert'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('MobileAppAlert.vue', () => {
711

812
const wrapper = shallowMount(MobileAppAlert, {
9-
mocks: {
10-
$http, $moment
11-
}
13+
mocks: { $http, $moment },
14+
localVue
1215
})
1316

1417
it('Check component MobileAppAlert', () => {

test/unit/specs/SocialMediaLinks.spec.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import SocialMediaLinks from '@/components/SocialMediaLinks'
3+
import BootstrapVue from 'bootstrap-vue'
34
import $moment from 'moment'
45
import $http from 'axios'
56

7+
const localVue = createLocalVue()
8+
localVue.use(BootstrapVue)
9+
610
describe('SocialMediaLinks.vue', () => {
711

812
const wrapper = shallowMount(SocialMediaLinks, {
9-
mocks: { $http, $moment }
13+
mocks: { $http, $moment },
14+
localVue
1015
})
1116

1217
it('Check component SocialMediaLinks', () => {

test/unit/specs/Spinner.spec.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { shallowMount } from '@vue/test-utils'
1+
import { shallowMount, createLocalVue } from '@vue/test-utils'
22
import Spinner from '@/components/Spinner'
3+
import BootstrapVue from 'bootstrap-vue'
4+
5+
const localVue = createLocalVue()
6+
localVue.use(BootstrapVue)
37

48
describe('Spinner.vue', () => {
59
const wrapper = shallowMount(Spinner, {
6-
mocks: {
7-
}
10+
mocks: {},
11+
localVue
812
})
913
it('Check simple spinner', () => {
1014
expect(wrapper.contains('.vue-simple-spinner')).to.eql(true)

0 commit comments

Comments
 (0)