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

Return an unresolved promise when loading javascript resource urls in…
This commit is contained in:
Calen Pennington
2018-09-19 19:14:15 -04:00
committed by GitHub
2 changed files with 29 additions and 3 deletions

View File

@@ -139,6 +139,7 @@
kind = resource.kind,
placement = resource.placement,
data = resource.data;
var loaded;
if (mimetype === 'text/css') {
if (kind === 'text') {
// xss-lint: disable=javascript-jquery-append,javascript-concat-html
@@ -152,7 +153,11 @@
// xss-lint: disable=javascript-jquery-append,javascript-concat-html
$head.append('<script>' + data + '</script>');
} else if (kind === 'url') {
$script(data, data);
loaded = $.Deferred();
$script(data, data, function() {
loaded.resolve()
});
return loaded.promise();
}
} else if (mimetype === 'text/html') {
if (placement === 'head') {

View File

@@ -2,6 +2,7 @@
Conditional Pages
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise, BrokenPromise
POLL_ANSWER = 'Yes, of course'
@@ -17,14 +18,34 @@ class ConditionalPage(PageObject):
"""
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):
"""
Returns True if the conditional's content has been revealed,
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):
"""