implement and test final proposal
This commit is contained in:
parent
f5c81d6767
commit
ca80dfbfa3
3 changed files with 474 additions and 246 deletions
|
@ -814,191 +814,6 @@ describe('Pattern', () => {
|
|||
expect(count).to.equal(2)
|
||||
})
|
||||
|
||||
describe('Hiding parts', () => {
|
||||
const blankDraft = ({ part }) => part
|
||||
const afterPart = {
|
||||
name: 'afterPart',
|
||||
draft: blankDraft,
|
||||
}
|
||||
const fromPart = {
|
||||
name: 'fromPart',
|
||||
draft: blankDraft,
|
||||
}
|
||||
describe('{hide: true}', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
hide: true,
|
||||
draft: blankDraft,
|
||||
}
|
||||
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [mainPart],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('Should hide the part', () => {
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.true
|
||||
})
|
||||
|
||||
it("Should not hide the part's dependencies", () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.false
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.false
|
||||
})
|
||||
|
||||
describe('Nested Parts', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const grandChild = {
|
||||
name: 'grandChild',
|
||||
from: mainPart,
|
||||
hide: true,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [grandChild],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('should not hide nested `from` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.false
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.false
|
||||
})
|
||||
|
||||
it('should not hide nested `after` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.false
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('{hideDependencies: true}', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
hideDependencies: true,
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [mainPart],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('Should not hide the part', () => {
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.false
|
||||
})
|
||||
it("Should hide the part's `from` dependencies", () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.true
|
||||
})
|
||||
it("Should not hide the part's `after` dependencies", () => {
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.false
|
||||
})
|
||||
|
||||
describe('Nested Parts', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const grandChild = {
|
||||
name: 'grandChild',
|
||||
from: mainPart,
|
||||
hideDependencies: true,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [grandChild],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('should hide nested `from` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.true
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.true
|
||||
})
|
||||
|
||||
it('should not hide nested `after` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.false
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('{hideAll: true}', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
hideAll: true,
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [mainPart],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('Should hide the part', () => {
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.true
|
||||
})
|
||||
it("Should hide the part's `from` dependencies", () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.true
|
||||
})
|
||||
it("Should hide the part's `after` dependencies", () => {
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.true
|
||||
})
|
||||
|
||||
describe('Nested Parts', () => {
|
||||
const mainPart = {
|
||||
name: 'mainPart',
|
||||
after: afterPart,
|
||||
from: fromPart,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const grandChild = {
|
||||
name: 'grandChild',
|
||||
from: mainPart,
|
||||
hideAll: true,
|
||||
draft: blankDraft,
|
||||
}
|
||||
const Test = new Design({
|
||||
name: 'test',
|
||||
parts: [grandChild],
|
||||
})
|
||||
|
||||
const pattern = new Test()
|
||||
pattern.__init()
|
||||
|
||||
it('should hide nested `from` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('fromPart')).to.be.true
|
||||
expect(pattern.__isPartHidden('mainPart')).to.be.true
|
||||
})
|
||||
|
||||
it('should hide nested `after` dependencies', () => {
|
||||
expect(pattern.__isPartHidden('afterPart')).to.be.true
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Should check whether created parts get the pattern context', () => {
|
||||
let partContext
|
||||
const plugin = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue