Skip to content

Commit

Permalink
rename two-pass tests to reflect new reality.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Jan 10, 2025
1 parent 4fd63ae commit e2b4a75
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/two-pass.js → test/retain-hidden-state.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("Two-pass option for retaining more state", function () {
describe("algorithm", function () {
setup();

it("preserves all non-attribute element state with two-pass option", function () {
it("preserves all non-attribute element state", function () {
getWorkArea().append(
make(`
<div>
Expand Down Expand Up @@ -30,7 +30,7 @@ describe("Two-pass option for retaining more state", function () {
states.should.eql([true, true]);
});

it("preserves all non-attribute element state with two-pass option and outerHTML morphStyle", function () {
it("preserves all non-attribute element state and outerHTML morphStyle", function () {
const div = make(`
<div>
<input type="checkbox" id="first">
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("Two-pass option for retaining more state", function () {
states.should.eql([true, true]);
});

it("preserves focus state with two-pass option and outerHTML morphStyle", function () {
it("preserves focus state and outerHTML morphStyle", function () {
const div = make(`
<div>
<input type="text" id="first">
Expand Down Expand Up @@ -478,7 +478,7 @@ describe("Two-pass option for retaining more state", function () {
});

it("duplicate ids on elements aborts matching to avoid invalid morph state", function () {
// twoPass can try and reuse existing id's where possible and has to exclude matching on duplicate ids
// we try to reuse existing ids where possible and has to exclude matching on duplicate ids
// to avoid losing content
getWorkArea().append(
make(`
Expand Down Expand Up @@ -518,8 +518,7 @@ describe("Two-pass option for retaining more state", function () {
});

it("duplicate destination ids on elements aborts matching to avoid invalid morph state", function () {
// twoPass can try and reuse existing id's where possible and has to exclude matching on duplicate ids
// to avoid losing content
// exclude matching on duplicate ids to avoid losing content
getWorkArea().append(
make(`
<div>
Expand Down Expand Up @@ -555,7 +554,7 @@ describe("Two-pass option for retaining more state", function () {
document.activeElement.outerHTML.should.equal(document.body.outerHTML);
});

it("preserves all non-attribute element state with two-pass option and outerHTML morphStyle when morphing to two top level nodes", function () {
it("preserves all non-attribute element state and outerHTML morphStyle when morphing to two top level nodes", function () {
// when using outerHTML you can replace one node with two nodes with the state preserving items split and it will just
// pick one best node to morph and just insert the other nodes so need to check these also retain state
const div = make(`
Expand Down Expand Up @@ -583,7 +582,7 @@ describe("Two-pass option for retaining more state", function () {
states.should.eql([true, true]);
});

it("preserves all non-attribute element state with two-pass option and outerHTML morphStyle when morphing to two top level nodes with nesting", function () {
it("preserves all non-attribute element state and outerHTML morphStyle when morphing to two top level nodes with nesting", function () {
// when using outerHTML you can replace one node with two nodes with the state preserving items split and it will just
// pick one best node to morph and just insert the other nodes so need to check these also retain state
const div = make(`
Expand Down Expand Up @@ -613,7 +612,7 @@ describe("Two-pass option for retaining more state", function () {
states.should.eql([true, true]);
});

it("preserves all non-attribute element state with two-pass option when wrapping element changes tag", function () {
it("preserves all non-attribute element state when wrapping element changes tag", function () {
// just changing the type from div to span of the wrapper causes softmatch to fail so it abandons all hope
// of morphing and just inserts the node so we need to check this still handles preserving state here.
const div = make(`
Expand All @@ -638,7 +637,7 @@ describe("Two-pass option for retaining more state", function () {
states.should.eql([true]);
});

it("preserves all non-attribute element state with two-pass option when wrapping element changes tag at top level", function () {
it("preserves all non-attribute element state when wrapping element changes tag at top level", function () {
// just changing the type from div to span of the top wrapping item with outerHTML morph will cause morphOldNodeTo function
// to morph the two nodes that don't softmatch that also needs to handle preserving state
const div = make(`<div><input type="checkbox" id="first"></div>`);
Expand Down

0 comments on commit e2b4a75

Please sign in to comment.