Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
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
Gabriel Monnerat
renderjs
Commits
e2bcdce3
Commit
e2bcdce3
authored
Aug 01, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate failure parameters.
parent
7e1d09df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
19 deletions
+54
-19
renderjs.js
renderjs.js
+14
-6
test/renderjs_test.js
test/renderjs_test.js
+40
-13
No files found.
renderjs.js
View file @
e2bcdce3
...
...
@@ -294,16 +294,23 @@
next_loading_gadget_deferred
.
resolve
(
gadget
);
}).
fail
(
function
()
{
// One error during css/js loading
next_loading_gadget_deferred
.
reject
();
next_loading_gadget_deferred
.
reject
.
apply
(
next_loading_gadget_deferred
,
arguments
);
});
}).
fail
(
function
()
{
// Failed to fetch dependencies information.
next_loading_gadget_deferred
.
reject
();
next_loading_gadget_deferred
.
reject
.
apply
(
next_loading_gadget_deferred
,
arguments
);
});
}).
fail
(
function
()
{
// Klass not correctly loaded. Reject instanciation
next_loading_gadget_deferred
.
reject
();
next_loading_gadget_deferred
.
reject
.
apply
(
next_loading_gadget_deferred
,
arguments
);
});
});
...
...
@@ -561,8 +568,8 @@
dfr
.
reject
(
jqXHR
,
"
Unexpected content type
"
);
}
})
.
fail
(
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
dfr
.
reject
(
jqXHR
,
textStatus
,
errorThrown
);
.
fail
(
function
()
{
dfr
.
reject
.
apply
(
dfr
,
arguments
);
});
}
return
dfr
.
promise
();
...
...
@@ -744,7 +751,8 @@
gadget_loading_klass
=
undefined
;
loading_gadget_deferred
.
resolve
();
}).
fail
(
function
()
{
loading_gadget_deferred
.
reject
();
loading_gadget_deferred
.
reject
.
apply
(
loading_gadget_deferred
,
arguments
);
});
});
}
...
...
test/renderjs_test.js
View file @
e2bcdce3
...
...
@@ -321,7 +321,9 @@
ok
(
false
,
"
text/plain should fail
"
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
200
"
,
jqXHR
.
status
);
equal
(
jqXHR
.
status
,
"
200
"
);
equal
(
textStatus
,
"
Unexpected content type
"
);
equal
(
jqXHR
.
getResponseHeader
(
"
Content-Type
"
),
"
text/plain
"
);
})
.
always
(
function
()
{
start
();
...
...
@@ -347,10 +349,11 @@
stop
();
renderJS
.
declareGadgetKlass
(
url
)
.
done
(
function
()
{
ok
(
false
,
"
text/plain
should fail
"
);
ok
(
false
,
"
Non parsable HTML
should fail
"
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
200
"
,
jqXHR
.
status
);
equal
(
textStatus
,
"
HTML Parsing failed
"
);
})
.
always
(
function
()
{
mock
.
verify
();
...
...
@@ -455,7 +458,7 @@
ok
(
false
,
"
404 should fail
"
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
404
"
,
jqXHR
.
status
);
equal
(
jqXHR
.
status
,
"
404
"
);
})
.
always
(
function
()
{
start
();
...
...
@@ -474,7 +477,7 @@
ok
(
false
,
"
404 should fail
"
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
404
"
,
jqXHR
.
status
);
equal
(
jqXHR
.
status
,
"
404
"
);
})
.
always
(
function
()
{
start
();
...
...
@@ -779,11 +782,34 @@
});
});
// test('clearGadgetKlassList leads to CSS reload', function () {
// // Check that declareCSS reload the CSS
// // after clearGadgetKlassList is called
// ok(false, "not implemented");
// });
test
(
'
clearGadgetKlassList leads to CSS reload
'
,
function
()
{
// Check that declareCSS reload the CSS
// after clearGadgetKlassList is called
var
url
=
"
data:text/css;base64,
"
+
window
.
btoa
(
"
#qunit-fixture {background-color: blue;}
"
),
count
=
$
(
'
head
'
).
find
(
'
link[rel=stylesheet]
'
).
length
;
stop
();
renderJS
.
declareCSS
(
url
)
.
done
(
function
()
{
renderJS
.
clearGadgetKlassList
();
equal
(
$
(
'
head
'
).
find
(
'
link[rel=stylesheet]
'
).
length
,
count
+
1
);
renderJS
.
declareCSS
(
url
)
.
done
(
function
()
{
equal
(
$
(
'
head
'
).
find
(
'
link[rel=stylesheet]
'
).
length
,
count
+
2
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
ok
(
false
,
"
Failed to load
"
+
textStatus
+
"
"
+
jqXHR
.
status
);
})
.
always
(
function
()
{
start
();
});
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
ok
(
false
,
"
Failed to load
"
+
textStatus
+
"
"
+
jqXHR
.
status
);
start
();
});
});
/////////////////////////////////////////////////////////////////
// RenderJSGadget.getInterfaceList
...
...
@@ -1309,8 +1335,8 @@
.
done
(
function
(
new_gadget
)
{
ok
(
false
);
})
.
fail
(
function
()
{
ok
(
true
);
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
404
"
,
jqXHR
.
status
);
})
.
always
(
function
()
{
start
();
...
...
@@ -1340,8 +1366,9 @@
.
done
(
function
(
new_gadget
)
{
ok
(
false
);
})
.
fail
(
function
()
{
ok
(
true
);
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
jqXHR
.
status
,
404
);
equal
(
textStatus
,
"
error
"
);
})
.
always
(
function
()
{
start
();
...
...
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