From 35c06a1cf38f8f7da488cd7e72464b66a8746805 Mon Sep 17 00:00:00 2001 From: MichaelWest22 Date: Thu, 19 Dec 2024 09:30:43 +1300 Subject: [PATCH] Added test --- test/core.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/test/core.js b/test/core.js index c0e01f3..141c349 100644 --- a/test/core.js +++ b/test/core.js @@ -320,7 +320,7 @@ describe("Core morphing tests", function(){ document.body.removeChild(parent); }); - it('can prevent element addition w/ the beforeNodeAdded callback', function() { + it.only('can prevent element addition w/ the beforeNodeAdded callback', function() { let parent = make("

1

2

"); document.body.append(parent); @@ -474,4 +474,35 @@ describe("Core morphing tests", function(){ } }); + it('non-attribute state of element with id is not transfered to other elements when moved between different containers', function() + { + getWorkArea().append(make(` +
+
+ +
+ +
+ `)); + document.getElementById("first").indeterminate = true + + let finalSrc = ` +
+
+ +
+ +
+ `; + Idiomorph.morph(getWorkArea(), finalSrc, {morphStyle:'innerHTML'}); + + getWorkArea().innerHTML.should.equal(finalSrc); + // second checkbox is now in firsts place and we don't want firsts indeterminate state to be retained + // on what is now the second element so we need to prevent softMatch mroph from matching persistent id's + document.getElementById("second").indeterminate.should.eql(false) + }); })