Skip to content

Commit

Permalink
Add failing test for #16314
Browse files Browse the repository at this point in the history
  • Loading branch information
chancancode committed Sep 25, 2018
1 parent 830d766 commit 74ebe7b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
24 changes: 24 additions & 0 deletions packages/ember-glimmer/tests/integration/content-test.js
Expand Up @@ -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');
}
}
);

Expand Down Expand Up @@ -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');
}
}
);
Expand Down
28 changes: 27 additions & 1 deletion packages/ember-glimmer/tests/integration/syntax/each-test.js
Expand Up @@ -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 {
Expand Down Expand Up @@ -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']() {
Expand Down

0 comments on commit 74ebe7b

Please sign in to comment.