Skip to content

Commit

Permalink
fix: created cleanClasses function for text test
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Akpa committed Mar 7, 2019
1 parent b66db7f commit 0c8d913
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/unit/FishTankText.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { mount, shallowMount as shallow } from '@vue/test-utils'
import { expect } from "chai"
import FishTankText from '@/components/FishTankText.vue'

const getCleanClassNames = function(classList:any):Array<string>{
let classArray = Array.from(classList)
let cleanClasses = classArray.map((c:any)=>{
return c.split('_')[1]
})
return cleanClasses
}
describe('FishTankText.vue', () => {
const propsData = {
prop1: '',
Expand Down Expand Up @@ -37,10 +43,7 @@ describe('FishTankText.vue', () => {
it('contains default classes of alignLeft, antialiased, colorBlack, fontSizeBaseLg and primary', () =>{
const defaultClasses = [ 'alignLeft','antialiased','colorBlack','fontSizeBaseLg','primary' ]
const wrapper = mountInput()
let classArray = Array.from(wrapper.element.classList)
let cleanClasses = classArray.map((c:String)=>{
return c.split('_')[1]
})
let cleanClasses = getCleanClassNames(wrapper.element.classList)
cleanClasses.forEach(c=>{
expect(defaultClasses.indexOf(c) >-1)
})
Expand Down

0 comments on commit 0c8d913

Please sign in to comment.