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
Boris Kocherov
rsvp.js
Commits
75ae49a2
Commit
75ae49a2
authored
Aug 29, 2013
by
Stefan Penner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #107 from twokul/master
fixing tests for rethrow in IE 6,7,8 as well as phantom/node
parents
885fe7ab
64c22561
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
lib/rsvp/async.js
lib/rsvp/async.js
+2
-1
test/index.html
test/index.html
+1
-1
test/tests/extension_test.js
test/tests/extension_test.js
+16
-14
No files found.
lib/rsvp/async.js
View file @
75ae49a2
var
browserGlobal
=
(
typeof
window
!==
'
undefined
'
)
?
window
:
{};
var
browserGlobal
=
(
typeof
window
!==
'
undefined
'
)
?
window
:
{};
var
BrowserMutationObserver
=
browserGlobal
.
MutationObserver
||
browserGlobal
.
WebKitMutationObserver
;
var
BrowserMutationObserver
=
browserGlobal
.
MutationObserver
||
browserGlobal
.
WebKitMutationObserver
;
var
async
;
var
async
;
var
local
=
(
typeof
global
!==
'
undefined
'
)
?
global
:
this
;
// old node
// old node
function
useNextTick
()
{
function
useNextTick
()
{
...
@@ -51,7 +52,7 @@ function useMutationObserver() {
...
@@ -51,7 +52,7 @@ function useMutationObserver() {
function
useSetTimeout
()
{
function
useSetTimeout
()
{
return
function
(
callback
,
arg
)
{
return
function
(
callback
,
arg
)
{
glob
al
.
setTimeout
(
function
()
{
loc
al
.
setTimeout
(
function
()
{
callback
(
arg
);
callback
(
arg
);
},
1
);
},
1
);
};
};
...
...
test/index.html
View file @
75ae49a2
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
</head>
</head>
<body>
<body>
<div
id=
"mocha"
></div>
<div
id=
"mocha"
></div>
<script
src=
"../dist/rsvp-2.0.
1
.js"
></script>
<script
src=
"../dist/rsvp-2.0.
2
.js"
></script>
<script
src=
"vendor/assert.js"
></script>
<script
src=
"vendor/assert.js"
></script>
<script
src=
"vendor/mocha.js"
></script>
<script
src=
"vendor/mocha.js"
></script>
<script>
mocha
.
setup
({
ui
:
'
bdd
'
,
timeout
:
200
});
mocha
.
globals
([
'
setTimeout
'
]);
</script>
<script>
mocha
.
setup
({
ui
:
'
bdd
'
,
timeout
:
200
});
mocha
.
globals
([
'
setTimeout
'
]);
</script>
...
...
test/tests/extension_test.js
View file @
75ae49a2
/*global describe, specify, it, assert */
/*global describe, specify, it, assert */
var
local
=
(
typeof
global
===
"
undefined
"
)
?
this
:
global
;
var
local
=
(
typeof
global
===
"
undefined
"
)
?
this
:
global
,
oldSetTimeout
,
newSetTimeout
;
local
.
setTimeout
=
local
.
setTimeout
;
oldSetTimeout
=
local
.
setTimeout
;
newSetTimeout
=
function
(
callback
)
{
var
errorWasThrown
;
try
{
callback
.
call
(
this
,
arguments
);
}
catch
(
e
)
{
errorWasThrown
=
true
;
}
};
if
(
typeof
Object
.
getPrototypeOf
!==
"
function
"
)
{
if
(
typeof
Object
.
getPrototypeOf
!==
"
function
"
)
{
Object
.
getPrototypeOf
=
""
.
__proto__
===
String
.
prototype
Object
.
getPrototypeOf
=
""
.
__proto__
===
String
.
prototype
...
@@ -727,7 +738,7 @@ describe("RSVP extensions", function() {
...
@@ -727,7 +738,7 @@ describe("RSVP extensions", function() {
});
});
describe
(
"
RSVP.rethrow
"
,
function
()
{
describe
(
"
RSVP.rethrow
"
,
function
()
{
var
onerror
,
oldSetTimeout
=
global
.
setTimeout
;
var
onerror
;
after
(
function
()
{
after
(
function
()
{
global
.
setTimeout
=
oldSetTimeout
;
global
.
setTimeout
=
oldSetTimeout
;
...
@@ -740,19 +751,8 @@ describe("RSVP extensions", function() {
...
@@ -740,19 +751,8 @@ describe("RSVP extensions", function() {
it
(
"
rethrows an error
"
,
function
(
done
)
{
it
(
"
rethrows an error
"
,
function
(
done
)
{
var
thrownError
=
new
Error
(
'
I am an error.
'
);
var
thrownError
=
new
Error
(
'
I am an error.
'
);
local
.
setTimeout
=
function
(
callback
)
{
done
();
var
errorWasThrown
=
false
;
try
{
callback
.
call
(
this
,
arguments
);
}
catch
(
e
)
{
errorWasThrown
=
true
;
}
assert
(
errorWasThrown
,
'
expect that an error was thrown
'
);
};
function
expectRejection
(
reason
)
{
function
expectRejection
(
reason
)
{
done
();
assertEqual
(
reason
,
thrownError
);
assertEqual
(
reason
,
thrownError
);
}
}
...
@@ -761,6 +761,8 @@ describe("RSVP extensions", function() {
...
@@ -761,6 +761,8 @@ describe("RSVP extensions", function() {
assert
(
false
,
value
);
assert
(
false
,
value
);
}
}
global
.
setTimeout
=
newSetTimeout
;
RSVP
.
reject
(
thrownError
).
RSVP
.
reject
(
thrownError
).
fail
(
RSVP
.
rethrow
).
fail
(
RSVP
.
rethrow
).
then
(
doNotExpectFulfillment
,
expectRejection
);
then
(
doNotExpectFulfillment
,
expectRejection
);
...
...
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