blob: 04a806d65b41089ba942fdf0cca135dd5cafc7d8 [file] [log] [blame]
description('Test Promise.resolve in non dom directory.');
var globalObject = this;
globalObject.jsTestIsAsync = true;
var value = {
then: function(fulfillCallback, rejectCallback) {
testPassed('value.then is called.');
globalObject.thisValue = this;
shouldBe('thisValue', 'value');
fulfillCallback('hello');
}
};
var promise = new Promise(function(resolve) { resolve(value); });
promise.then(function(result) {
testPassed('fulfilled');
globalObject.result = result;
shouldBeEqualToString('result', 'hello');
finishJSTest();
}, function() {
testFailed('rejected');
finishJSTest();
});
debug('The promise is not fulfilled until after this function call executes.');