bootstrap-vue
Version:
BootstrapVue, with more than 85 custom components, over 45 plugins, several custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated W
32 lines (27 loc) • 974 B
JavaScript
import copyProps from './copy-props'
describe('utils/copyProps', () => {
it('works with array props', async () => {
const props = ['a', 'b', 'c']
expect(copyProps(props)).toEqual(props)
// Should be a new array reference
expect(copyProps(props)).not.toBe(props)
})
it('works with object props', async () => {
const props = {
a: { type: String, default: 'foobar' },
b: { type: [Object, Array], default: null },
c: 'c'
}
expect(copyProps(props)).toEqual(props)
// Should be a new object reference
expect(copyProps(props)).not.toBe(props)
// Properties should be new object references
expect(copyProps(props).a).not.toBe(props.a)
expect(copyProps(props).a).toEqual(props.a)
expect(copyProps(props).b).not.toBe(props.b)
expect(copyProps(props).b).toEqual(props.b)
// Except for primatives
expect(copyProps(props).c).toBe(props.c)
expect(copyProps(props).c).toEqual(props.c)
})
})