From 2acfc3ec2fd09ebbc9c4fad8cdf0682388f8a56f Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 29 Jan 2015 01:23:16 +0900 Subject: [PATCH] fix travis ci failed --- es6-promise/es6-promise-tests.ts | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index 3bf5d3707a..dc54f3b1ba 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -38,26 +38,26 @@ promiseStringArr = allResult; //race test var raceResult = Promise.race(arrayOfPromise); promiseString = raceResult; - + //then test var thenWithPromiseResult = promiseString.then(word => Promise.resolve(word.length)); promiseNumber = thenWithPromiseResult; var thenWithPromiseResultAndPromiseReject = promiseString.then(word => Promise.resolve(word.length), error => Promise.resolve(10)); -promiseNumber = thenWithPromiseResultAndPromiseReject; +promiseNumber = thenWithPromiseResultAndPromiseReject; var thenWithPromiseResultAndSimpleReject = promiseString.then(word => Promise.resolve(word.length), error => 10); -promiseNumber = thenWithPromiseResultAndSimpleReject; - +promiseNumber = thenWithPromiseResultAndSimpleReject; + var thenWithSimpleResult = promiseString.then(word => word.length); promiseNumber = thenWithSimpleResult; var thenWithSimpleResultAndPromiseReject = promiseString.then(word => word.length, error => Promise.resolve(10)); -promiseNumber = thenWithSimpleResultAndPromiseReject; +promiseNumber = thenWithSimpleResultAndPromiseReject; var thenWithSimpleResultAndSimpleReject = promiseString.then(word => word.length, error => 10); -promiseNumber = thenWithSimpleResultAndSimpleReject; +promiseNumber = thenWithSimpleResultAndSimpleReject; var thenWithUndefinedFullFillAndSimpleReject = promiseString.then(undefined, error => 10); promiseNumber = thenWithUndefinedFullFillAndSimpleReject; @@ -71,13 +71,16 @@ promiseNumber = thenWithNoResultAndNoReject; var voidPromise = new Promise(function (resolve) { resolve(); }); //catch test -var catchWithSimpleResult = promiseString.catch(error => 10); +var catchWithSimpleResult = promiseString.catch(error => 10); promiseNumber = catchWithSimpleResult; -var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10)); +var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10)); promiseNumber = catchWithPromiseResult; -promiseString = promiseString.catch(function () { throw new Error('Better error msg'); }); +promiseString = promiseString.catch(function () { + throw new Error('Better error msg'); + return null; +}); //examples coming from http://www.html5rocks.com/en/tutorials/es6/promises/ @@ -87,7 +90,7 @@ function get(url: string) { // Do the usual XHR stuff var req = new XMLHttpRequest(); req.open('GET', url); - + req.onload = function() { // This is called even on 404 etc // so check the status @@ -101,12 +104,12 @@ function get(url: string) { reject(Error(req.statusText)); } }; - + // Handle network errors req.onerror = function() { reject(Error("Network Error")); }; - + // Make the request req.send(); }); @@ -119,11 +122,11 @@ function getJSON(url: string) { } function addHtmlToPage(html: string) { - + } function addTextToPage(text: string) { - + } interface Story {