-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
4 changed files
with
56 additions
and
27 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,23 +1,31 @@ | ||
import { mount } from 'avoriaz'; | ||
import Display from '@/components/Display'; | ||
import Gradients from '../../../gradients.json'; | ||
|
||
const wrapper = mount(Display, { | ||
propsData: { | ||
direction: 'to left', | ||
gradient: { | ||
colors: ['#1FA2FF', '#21DCF6', '#A6FFCB'], | ||
name: 'Stripe', | ||
}, | ||
}, | ||
}); | ||
const findDuplicatesinArrayByKeyValue = (array, propertyName) => { | ||
let seenDuplicate = false; | ||
let testObject = {}; | ||
let dupes = []; | ||
|
||
array.map((item) => { | ||
var itemPropertyName = item[propertyName]; | ||
if (itemPropertyName in testObject) { | ||
dupes.push(itemPropertyName); | ||
testObject[itemPropertyName].duplicate = true; | ||
item.duplicate = true; | ||
seenDuplicate = true; | ||
} | ||
else { | ||
testObject[itemPropertyName] = item; | ||
delete item.duplicate; | ||
} | ||
}) | ||
|
||
return seenDuplicate; | ||
} | ||
|
||
describe('Display.vue', () => { | ||
it('It renders element correctly', () => { | ||
expect(wrapper.is('.display')).to.equal(true); | ||
}); | ||
|
||
it('should have a gradient as background style', () => { | ||
expect(wrapper.hasStyle('background', 'linear-gradient(to left, #1FA2FF,#21DCF6,#A6FFCB)')) | ||
.to.equal(true); | ||
describe('Duplicate gradients', () => { | ||
it('Has no duplicate gradient names', () => { | ||
const dupes = findDuplicatesinArrayByKeyValue(Gradients, 'name'); | ||
expect(dupes).to.equal(false); | ||
}); | ||
}); |
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 { mount } from 'avoriaz'; | ||
import Display from '@/components/Display'; | ||
|
||
const wrapper = mount(Display, { | ||
propsData: { | ||
direction: 'to left', | ||
gradient: { | ||
colors: ['#1FA2FF', '#21DCF6', '#A6FFCB'], | ||
name: 'Stripe', | ||
}, | ||
}, | ||
}); | ||
|
||
describe('Display.vue', () => { | ||
it('It renders element correctly', () => { | ||
expect(wrapper.is('.display')).to.equal(true); | ||
}); | ||
|
||
it('should have a gradient as background style', () => { | ||
expect(wrapper.hasStyle('background', 'linear-gradient(to left, #1FA2FF,#21DCF6,#A6FFCB)')) | ||
.to.equal(true); | ||
}); | ||
}); |