Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rsvp.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
rsvp.js
Commits
d8d19e41
Commit
d8d19e41
authored
May 28, 2013
by
Teddy Zeenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Throw exception in all called without an array
parent
71f121c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/rsvp/all.js
lib/rsvp/all.js
+3
-0
tests/extension-tests.js
tests/extension-tests.js
+14
-0
No files found.
lib/rsvp/all.js
View file @
d8d19e41
import
{
Promise
}
from
"
rsvp/promise
"
;
function
all
(
promises
)
{
if
(
toString
.
call
(
promises
)
!==
"
[object Array]
"
)
{
throw
new
TypeError
(
'
You must pass an array to all.
'
);
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
results
=
[],
remaining
=
promises
.
length
,
promise
;
...
...
tests/extension-tests.js
View file @
d8d19e41
...
...
@@ -483,6 +483,20 @@ describe("RSVP extensions", function() {
assert
(
RSVP
.
all
);
});
it
(
'
throws when not passed an array
'
,
function
()
{
assert
.
throws
(
function
()
{
var
all
=
RSVP
.
all
();
},
TypeError
);
assert
.
throws
(
function
()
{
var
all
=
RSVP
.
all
(
''
);
},
TypeError
);
assert
.
throws
(
function
()
{
var
all
=
RSVP
.
all
({});
},
TypeError
);
});
specify
(
'
fulfilled only after all of the other promises are fulfilled
'
,
function
(
done
)
{
var
firstResolved
,
secondResolved
,
firstResolver
,
secondResolver
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment