-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spike out initial twoPass option for additional state retention.
- Loading branch information
1 parent
31617cd
commit a8a45e7
Showing
2 changed files
with
103 additions
and
2 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,52 @@ | ||
describe("Two-pass option for retaining more state", function(){ | ||
|
||
beforeEach(function() { | ||
clearWorkArea(); | ||
}); | ||
|
||
it('fails to preserve all non-attribute element state with single-pass option', function() | ||
{ | ||
getWorkArea().append(make(` | ||
<div> | ||
<input type="checkbox" checked id="first"> | ||
<input type="checkbox" checked id="second"> | ||
</div> | ||
`)); | ||
document.getElementById("first").indeterminate = true | ||
document.getElementById("second").indeterminate = true | ||
|
||
let finalSrc = ` | ||
<div> | ||
<input type="checkbox" checked id="second"> | ||
<input type="checkbox" checked id="first"> | ||
</div> | ||
`; | ||
Idiomorph.morph(getWorkArea(), finalSrc, {morphStyle:'innerHTML'}); | ||
|
||
document.getElementById("first").indeterminate.should.be.false | ||
document.getElementById("second").indeterminate.should.be.true | ||
}); | ||
|
||
it('preserves all non-attribute element state with two-pass option', function() | ||
{ | ||
getWorkArea().append(make(` | ||
<div> | ||
<input type="checkbox" checked id="first"> | ||
<input type="checkbox" checked id="second"> | ||
</div> | ||
`)); | ||
document.getElementById("first").indeterminate = true | ||
document.getElementById("second").indeterminate = true | ||
|
||
let finalSrc = ` | ||
<div> | ||
<input type="checkbox" checked id="second"> | ||
<input type="checkbox" checked id="first"> | ||
</div> | ||
`; | ||
Idiomorph.morph(getWorkArea(), finalSrc, {morphStyle:'innerHTML',twoPass:true}); | ||
|
||
document.getElementById("first").indeterminate.should.be.true | ||
document.getElementById("second").indeterminate.should.be.true | ||
}); | ||
}); |