diff --git a/packages/ember-glimmer/tests/integration/content-test.js b/packages/ember-glimmer/tests/integration/content-test.js index 4261db71b42..1c92a6bb3a1 100644 --- a/packages/ember-glimmer/tests/integration/content-test.js +++ b/packages/ember-glimmer/tests/integration/content-test.js @@ -702,6 +702,22 @@ moduleFor( this.assertTextNode(this.firstChild, content); // this.takeSnapshot(); } + + ['@test it can render empty safe strings [GH#16314]']() { + this.render('before {{value}} after', { value: htmlSafe('hello') }); + + this.assertHTML('before hello after'); + + this.assertStableRerender(); + + this.runTask(() => set(this.context, 'value', htmlSafe(''))); + + this.assertHTML('before after'); + + this.runTask(() => set(this.context, 'value', htmlSafe('hello'))); + + this.assertHTML('before hello after'); + } } ); @@ -853,6 +869,14 @@ moduleFor( this.runTask(() => set(this.context, 'value', 'hello')); this.assertContent('before hello after'); + + this.runTask(() => set(this.context, 'value', htmlSafe(''))); + + this.assertContent('before after'); + + this.runTask(() => set(this.context, 'value', 'hello')); + + this.assertContent('before hello after'); } } ); diff --git a/packages/ember-glimmer/tests/integration/syntax/each-test.js b/packages/ember-glimmer/tests/integration/syntax/each-test.js index 27e639e8464..7bfd42e0d43 100644 --- a/packages/ember-glimmer/tests/integration/syntax/each-test.js +++ b/packages/ember-glimmer/tests/integration/syntax/each-test.js @@ -2,7 +2,7 @@ import { get, set, notifyPropertyChange } from 'ember-metal'; import { applyMixins, strip } from '../../utils/abstract-test-case'; import { moduleFor, RenderingTest } from '../../utils/test-case'; import { A as emberA, ArrayProxy, RSVP } from 'ember-runtime'; -import { Component } from '../../utils/helpers'; +import { Component, htmlSafe } from '../../utils/helpers'; import { HAS_NATIVE_SYMBOL } from 'ember-utils'; import { @@ -827,6 +827,32 @@ class EachTest extends AbstractEachTest { this.assertText(''); } + ['@test empty trusted content clears properly [GH#16314]']() { + this.makeList(['hello']); + + this.render(`before {{#each list as |value|}}{{{value}}}{{/each}} after`); + + this.assertText('before hello after'); + + this.assertStableRerender(); + + this.runTask(() => this.pushObjects([null, ' world'])); + + this.assertText('before hello world after'); + + this.runTask(() => this.replace(1, 2, [undefined, ' world!'])); + + this.assertText('before hello world! after'); + + this.runTask(() => this.replace(1, 2, [htmlSafe(''), ' world!!'])); + + this.assertText('before hello world!! after'); + + this.replaceList(['hello']); + + this.assertText('before hello after'); + } + /* multi each */ ['@test re-using the same variable with different {{#each}} blocks does not override each other']() {