Skip to content
Snippets Groups Projects
Unverified Commit 44c6936e authored by Calen Pennington's avatar Calen Pennington Committed by GitHub
Browse files

Merge pull request #18950 from cpennington/fix-educator-3262-v4

Return an unresolved promise when loading javascript resource urls in…
parents 3c129e91 5b7e59e0
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
kind = resource.kind, kind = resource.kind,
placement = resource.placement, placement = resource.placement,
data = resource.data; data = resource.data;
var loaded;
if (mimetype === 'text/css') { if (mimetype === 'text/css') {
if (kind === 'text') { if (kind === 'text') {
// xss-lint: disable=javascript-jquery-append,javascript-concat-html // xss-lint: disable=javascript-jquery-append,javascript-concat-html
...@@ -152,7 +153,11 @@ ...@@ -152,7 +153,11 @@
// xss-lint: disable=javascript-jquery-append,javascript-concat-html // xss-lint: disable=javascript-jquery-append,javascript-concat-html
$head.append('<script>' + data + '</script>'); $head.append('<script>' + data + '</script>');
} else if (kind === 'url') { } else if (kind === 'url') {
$script(data, data); loaded = $.Deferred();
$script(data, data, function() {
loaded.resolve()
});
return loaded.promise();
} }
} else if (mimetype === 'text/html') { } else if (mimetype === 'text/html') {
if (placement === 'head') { if (placement === 'head') {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Conditional Pages Conditional Pages
""" """
from bok_choy.page_object import PageObject from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise, BrokenPromise
POLL_ANSWER = 'Yes, of course' POLL_ANSWER = 'Yes, of course'
...@@ -17,14 +18,34 @@ class ConditionalPage(PageObject): ...@@ -17,14 +18,34 @@ class ConditionalPage(PageObject):
""" """
Returns True if the browser is currently on the right page. Returns True if the browser is currently on the right page.
""" """
return self.q(css='.conditional-wrapper').visible # This is all a hack to work around the fact that there's no way to adjust the
# timeout parameters for self.q
def check_fn():
return self.q(css='.conditional-wrapper').visible
try:
EmptyPromise(
check_fn,
"On conditional page",
).fulfill()
return True
except BrokenPromise:
return False
def is_content_visible(self): def is_content_visible(self):
""" """
Returns True if the conditional's content has been revealed, Returns True if the conditional's content has been revealed,
False otherwise False otherwise
""" """
return self.q(css='.hidden-contents').visible def check_fn():
return self.q(css='.hidden-contents').visible
try:
EmptyPromise(
check_fn,
"Conditional is visible",
).fulfill()
return True
except BrokenPromise:
return False
def fill_in_poll(self): def fill_in_poll(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment