mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added test cases for async errors and timeouts
This commit is contained in:
parent
2e7b59e10b
commit
fe3753d644
@ -281,4 +281,32 @@ describe('marko/marko-async' , function() {
|
||||
}, done);
|
||||
});
|
||||
|
||||
it("should allow for alternative error message (sync)", function(done) {
|
||||
testRender('test-project/html-templates/async-fragment-error.marko', {
|
||||
userInfo: function(done) {
|
||||
done(new Error('Invalid user'));
|
||||
}
|
||||
}, done);
|
||||
});
|
||||
|
||||
it("should allow for alternative error message (async)", function(done) {
|
||||
testRender('test-project/html-templates/async-fragment-error.marko', {
|
||||
userInfo: function(done) {
|
||||
setTimeout(function() {
|
||||
done(new Error('Invalid user'));
|
||||
}, 200);
|
||||
}
|
||||
}, done);
|
||||
});
|
||||
|
||||
it("should allow for alternative timeout message", function(done) {
|
||||
testRender('test-project/html-templates/async-fragment-timeout.marko', {
|
||||
userInfo: function(done) {
|
||||
setTimeout(function() {
|
||||
done(null, {});
|
||||
}, 600);
|
||||
}
|
||||
}, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
<async-fragment data-provider="data.userInfo" var="user">
|
||||
<async-fragment-error>
|
||||
1-An error has occurred!
|
||||
</async-fragment-error>
|
||||
1
|
||||
</async-fragment>
|
||||
<async-fragment data-provider="data.userInfo" var="user" error-message="2-An error has occurred!">
|
||||
2
|
||||
</async-fragment>
|
||||
@ -0,0 +1 @@
|
||||
1-An error has occurred!2-An error has occurred!
|
||||
@ -0,0 +1,9 @@
|
||||
<async-fragment data-provider="data.userInfo" var="user" timeout="300">
|
||||
<async-fragment-timeout>
|
||||
1-A timeout has occurred!
|
||||
</async-fragment-timeout>
|
||||
1
|
||||
</async-fragment>
|
||||
<async-fragment data-provider="data.userInfo" var="user" timeout-message="2-A timeout has occurred!" timeout="300">
|
||||
2
|
||||
</async-fragment>
|
||||
@ -0,0 +1 @@
|
||||
1-A timeout has occurred!2-A timeout has occurred!
|
||||
Loading…
x
Reference in New Issue
Block a user