-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't let changes to expect.output.preferredWidth propagate into exis…
…ting clones
- Loading branch information
1 parent
6ca8b50
commit 2ac944d
Showing
2 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/*global unexpected*/ | ||
|
||
describe('expect.output.preferredWidth', () => { | ||
var expect = unexpected.clone(); | ||
beforeEach(() => { | ||
expect = expect.clone(); | ||
expect.output.preferredWidth = 9999; | ||
}); | ||
|
||
describe('and a clone', () => { | ||
var clonedExpect; | ||
beforeEach(() => { | ||
clonedExpect = expect.clone(); | ||
}); | ||
|
||
it('should propagate into the clone', () => { | ||
expect(clonedExpect.output.preferredWidth, 'to be', 9999); | ||
}); | ||
|
||
describe('when the value is changed in the clone', () => { | ||
beforeEach(() => { | ||
clonedExpect.output.preferredWidth = 7777; | ||
}); | ||
|
||
it('should not affect the original', () => { | ||
expect(expect.output.preferredWidth, 'to be', 9999); | ||
}); | ||
}); | ||
|
||
describe('when the value is changed in the original after the clone was made', () => { | ||
beforeEach(() => { | ||
expect.output.preferredWidth = 5555; | ||
}); | ||
|
||
it('should not affect the clone', () => { | ||
expect(clonedExpect.output.preferredWidth, 'to be', 9999); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('and a child', () => { | ||
var childExpect; | ||
beforeEach(() => { | ||
childExpect = expect.child(); | ||
}); | ||
|
||
it('should propagate into the child', () => { | ||
expect(childExpect.output.preferredWidth, 'to be', 9999); | ||
}); | ||
|
||
describe('when the value is changed in the child', () => { | ||
beforeEach(() => { | ||
childExpect.output.preferredWidth = 7777; | ||
}); | ||
|
||
it('should not affect the original', () => { | ||
expect(expect.output.preferredWidth, 'to be', 9999); | ||
}); | ||
|
||
describe('and then in the parent', () => { | ||
beforeEach(() => { | ||
expect.output.preferredWidth = 4444; | ||
}); | ||
|
||
it('should not affect the child', () => { | ||
expect(childExpect.output.preferredWidth, 'to be', 7777); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('when the value is changed in the original after the child was made', () => { | ||
beforeEach(() => { | ||
expect.output.preferredWidth = 5555; | ||
}); | ||
|
||
it('should propagate the change to the child', () => { | ||
expect(childExpect.output.preferredWidth, 'to be', 5555); | ||
}); | ||
}); | ||
}); | ||
}); |