add test
This commit is contained in:
parent
6bdaa460aa
commit
f060abbee0
1 changed files with 34 additions and 0 deletions
|
@ -174,6 +174,40 @@ describe('Pattern', () => {
|
||||||
'Could not inject part `otherPart` into part `front`'
|
'Could not inject part `otherPart` into part `front`'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('Pattern.__pack()', () => {
|
||||||
|
it('should get a part stack name from a function', () => {
|
||||||
|
const expectedName = 'namedStack'
|
||||||
|
const front = {
|
||||||
|
name: 'front',
|
||||||
|
stack: function (settings, partName) {
|
||||||
|
return settings.options.stackName
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
stackName: {
|
||||||
|
dflt: expectedName,
|
||||||
|
list: [expectedName, 'otherStack'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
draft: function ({ part }) {
|
||||||
|
return part
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const Test = new Design({
|
||||||
|
name: 'test',
|
||||||
|
parts: [front],
|
||||||
|
})
|
||||||
|
|
||||||
|
const pattern = new Test()
|
||||||
|
pattern.draft()
|
||||||
|
pattern.__pack()
|
||||||
|
|
||||||
|
const stackNames = Object.keys(pattern.stacks)
|
||||||
|
expect(stackNames).to.include(expectedName)
|
||||||
|
expect(stackNames).not.to.include('front')
|
||||||
|
})
|
||||||
|
})
|
||||||
/*
|
/*
|
||||||
|
|
||||||
it('Should return all render props', () => {
|
it('Should return all render props', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue