Skip to content

Commit

Permalink
[BUGFIX beta] Prevent unsafe: protocol popups in test suite.
Browse files Browse the repository at this point in the history
When running the test suite under Safari (before these changes) you would have
a number of popups regarding the `unsafe:` protocol not having an application
associated.

The warning was triggered on Safari when the element is inserted into the DOM, this
change swaps from `view.appendTo` to `view.createElement()`. `createElement()` adds
the element but does not insert into the DOM (allowing us to do the assertions we need
but preventing this annoying popup).
  • Loading branch information
rwjblue committed May 31, 2015
1 parent 7e9cec4 commit 4eab5d8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import EmberView from "ember-views/views/view";
import compile from "ember-template-compiler/system/compile";
import { SafeString } from "ember-htmlbars/utils/string";
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
import { runDestroy } from "ember-runtime/tests/utils";
import environment from "ember-metal/environment";

var view;
Expand Down Expand Up @@ -71,7 +71,8 @@ for (var i=0, l=badTags.length; i<l; i++) {
context: { url: 'javascript://example.com' },
template: subject.unquotedTemplate
});
runAppend(view);

view.createElement();

equal(view.element.firstChild.getAttribute(subject.attr),
"unsafe:javascript://example.com",
Expand All @@ -83,7 +84,8 @@ for (var i=0, l=badTags.length; i<l; i++) {
context: { url: 'javascript://example.com' },
template: subject.quotedTemplate
});
runAppend(view);

view.createElement();

equal(view.element.firstChild.getAttribute(subject.attr),
"unsafe:javascript://example.com",
Expand All @@ -97,7 +99,7 @@ for (var i=0, l=badTags.length; i<l; i++) {
});

try {
runAppend(view);
view.createElement();

equal(view.element.firstChild.getAttribute(subject.attr),
"javascript://example.com",
Expand All @@ -113,7 +115,7 @@ for (var i=0, l=badTags.length; i<l; i++) {
context: { protocol: 'javascript:', path: '//example.com' },
template: subject.multipartTemplate
});
runAppend(view);
view.createElement();

equal(view.element.firstChild.getAttribute(subject.attr),
"unsafe:javascript://example.com",
Expand Down

0 comments on commit 4eab5d8

Please sign in to comment.