Skip to content

Commit

Permalink
update tests for htmlSafe/isHTMLSafe Ember.String deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Jan 17, 2021
1 parent 9a6cb32 commit df9ce14
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/ember/tests/reexports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { confirmExport } from 'internal-test-helpers';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
import { jQueryDisabled, jQuery } from '@ember/-internals/views';
import Resolver from '@ember/application/globals-resolver';
import { SafeString } from '@ember/-internals/glimmer';

moduleFor(
'ember reexports',
Expand Down Expand Up @@ -68,8 +69,19 @@ moduleFor(
});
}

['@test Ember.String.isHTMLSafe exports correctly'](assert) {
confirmExport(Ember, assert, 'String.isHTMLSafe', '@ember/-internals/glimmer', 'isHTMLSafe');
['@test Ember.String.htmlSafe reexport is deprecated'](assert) {
expectDeprecation(() => {
let safe = Ember.String.htmlSafe('<p>foo</p>');
assert.ok(safe instanceof SafeString, 'still returns a SafeString');
assert.equal(safe.string, '<p>foo</p>', 'the safe string represents the expected string');
}, /Importing htmlSafe from '@ember\/string' is deprecated/);
}

['@test Ember.String.isHTMLSafe reexport is deprecated'](assert) {
expectDeprecation(() => {
assert.notOk(Ember.String.isHTMLSafe('foo'), 'a plain string is not HTML aafe');
assert.ok(Ember.String.isHTMLSafe(new SafeString('foo')), 'a SafeString is HTML safe');
}, /Importing isHTMLSafe from '@ember\/string' is deprecated/);
}

['@test Ember.EXTEND_PROTOTYPES is present (but deprecated)'](assert) {
Expand Down Expand Up @@ -270,7 +282,6 @@ let allExports = [
['Handlebars.template', '@ember/-internals/glimmer', 'template'],
['HTMLBars.template', '@ember/-internals/glimmer', 'template'],
['Handlebars.Utils.escapeExpression', '@ember/-internals/glimmer', 'escapeExpression'],
['String.htmlSafe', '@ember/-internals/glimmer', 'htmlSafe'],
['_setComponentManager', '@ember/-internals/glimmer', 'setComponentManager'],
['_componentManagerCapabilities', '@glimmer/manager', 'componentCapabilities'],
['_setComponentTemplate', '@glimmer/manager', 'setComponentTemplate'],
Expand Down

0 comments on commit df9ce14

Please sign in to comment.