Skip to content

Commit

Permalink
[BUGFIX beta] fix(glimmer/utils/to-bool): htmlSafe
Browse files Browse the repository at this point in the history
Fixes #17486.
  • Loading branch information
buschtoens committed Jun 26, 2019
1 parent 8b90e83 commit 813f8dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/@ember/-internals/glimmer/lib/utils/to-bool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { isHTMLSafe } from '@ember/-internals/glimmer';
import { isArray } from '@ember/-internals/runtime';
import { Opaque } from '@glimmer/interfaces';

export default function toBool(predicate: Opaque): boolean {
if (isArray(predicate)) {
return (predicate as { length: number }).length !== 0;
} else if (isHTMLSafe(predicate)) {
return Boolean(String(predicate));
} else {
return Boolean(predicate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { RenderingTestCase, applyMixins, runTask } from 'internal-test-helpers';

import { assign } from '@ember/polyfills';
import { htmlSafe } from '@ember/-internals/glimmer';
import { get, set } from '@ember/-internals/metal';
import {
Object as EmberObject,
Expand Down Expand Up @@ -407,6 +408,7 @@ const IfUnlessWithTestCases = [
new Boolean(true),
new Boolean(false),
new Date(),
htmlSafe(' '),
]),

new StableFalsyGenerator([
Expand All @@ -418,6 +420,7 @@ const IfUnlessWithTestCases = [
[],
emberA(),
ObjectProxy.create({ content: undefined }),
htmlSafe(''),
]),

new ObjectProxyGenerator([
Expand Down

0 comments on commit 813f8dc

Please sign in to comment.