35 lines
721 B
HTML
35 lines
721 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="description"></div>
|
|
<div id="console"></div>
|
|
<script>
|
|
description('Test Promise.');
|
|
|
|
window.jsTestIsAsync = true;
|
|
var callback;
|
|
var promise = new Promise(function(resolve) {
|
|
resolve({then: function(fulfillCallback, rejectCallback) {
|
|
throw 'hello';
|
|
}}, true);
|
|
});
|
|
|
|
promise.then(function() {
|
|
testFailed('fulfilled');
|
|
finishJSTest();
|
|
}, function(result) {
|
|
testPassed('rejected');
|
|
window.result = result
|
|
shouldBeEqualToString('result', 'hello');
|
|
finishJSTest();
|
|
});
|
|
|
|
debug('The promise is already rejected now.');
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|