From 8f73fdb512851819ed2734c42e5f8427da54bcf2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 15 Oct 2019 07:22:57 -0700 Subject: [PATCH] Fixed comments in trashcan. --- core/trashcan.js | 5 +++++ tests/mocha/trashcan_test.js | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/trashcan.js b/core/trashcan.js index 6f45f130b..a452d2004 100644 --- a/core/trashcan.js +++ b/core/trashcan.js @@ -497,6 +497,11 @@ Blockly.Trashcan.prototype.cleanBlockXML_ = function(xml) { node.removeAttribute('y'); node.removeAttribute('id'); node.removeAttribute('disabled'); + if (node.nodeName == 'comment') { // Future proof just in case. + node.removeAttribute('h'); + node.removeAttribute('w'); + node.removeAttribute('pinned'); + } } // Try to go down the tree diff --git a/tests/mocha/trashcan_test.js b/tests/mocha/trashcan_test.js index c2e8584f5..992e2cd91 100644 --- a/tests/mocha/trashcan_test.js +++ b/tests/mocha/trashcan_test.js @@ -102,7 +102,9 @@ suite("Trashcan", function() { test("No Disabled - Disabled True", function() { sendDeleteEvent(''); sendDeleteEvent(''); - chai.assert.equal(this.trashcan.contents_.length, 2); + // Disabled tags get removed because disabled blocks aren't allowed to + // be dragged from flyouts. See #2239 and #3243. + chai.assert.equal(this.trashcan.contents_.length, 1); }); test("No Editable - Editable False", function() { sendDeleteEvent(''); @@ -244,9 +246,8 @@ suite("Trashcan", function() { ' comment_text' + '' ); - // TODO (#2574): These blocks are treated as different, but appear - // identical when the trashcan is opened. - chai.assert.equal(this.trashcan.contents_.length, 2); + // h & w tags are removed b/c the blocks appear the same. + chai.assert.equal(this.trashcan.contents_.length, 1); }); test("Different Comment Pinned", function() { sendDeleteEvent( @@ -259,9 +260,8 @@ suite("Trashcan", function() { ' comment_text' + '' ); - // TODO (#2574): These blocks are treated as different, but appear - // identical when the trashcan is opened. - chai.assert.equal(this.trashcan.contents_.length, 2); + // pinned tags are removed b/c the blocks appear the same. + chai.assert.equal(this.trashcan.contents_.length, 1); }); test("No Mutator - Mutator", function() { sendDeleteEvent('');