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
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
90a54b2f
Commit
90a54b2f
authored
Aug 06, 2013
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support content type parameters.
Thanks to Caleb James DeLisle.
parent
1da1d7bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
renderjs.js
renderjs.js
+3
-2
test/renderjs_test.js
test/renderjs_test.js
+31
-0
No files found.
renderjs.js
View file @
90a54b2f
...
...
@@ -615,8 +615,9 @@
$
.
ajax
(
url
)
.
done
(
function
(
value
,
textStatus
,
jqXHR
)
{
var
klass
,
tmp_constructor
,
key
;
if
((
jqXHR
.
getResponseHeader
(
"
Content-Type
"
)
||
""
)
===
'
text/html
'
)
{
if
(
/^text
\/
html
[
;
]?
/
.
test
(
jqXHR
.
getResponseHeader
(
"
Content-Type
"
)
||
""
))
{
try
{
if
(
!
gadget_model_dict
.
hasOwnProperty
(
url
))
{
...
...
test/renderjs_test.js
View file @
90a54b2f
...
...
@@ -440,6 +440,37 @@
server
.
respond
();
});
test
(
'
Content type parameter are supported
'
,
function
()
{
// Check that declareGadgetKlass does not fail if the page content type
// contains a parameter
var
server
=
sinon
.
fakeServer
.
create
(),
url
=
'
https://example.org/files/qunittest/test
'
;
server
.
respondWith
(
"
GET
"
,
url
,
[
200
,
{
"
Content-Type
"
:
"
text/html; charset=utf-8
"
,
},
"
<html></html>
"
]);
stop
();
renderJS
.
declareGadgetKlass
(
url
)
.
done
(
function
(
Klass
)
{
var
instance
;
equal
(
Klass
.
prototype
.
path
,
url
);
instance
=
new
Klass
();
ok
(
instance
instanceof
RenderJSGadget
);
ok
(
instance
instanceof
Klass
);
ok
(
Klass
!==
RenderJSGadget
);
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
ok
(
false
,
"
Failed to load
"
+
textStatus
+
"
"
+
jqXHR
.
status
);
})
.
always
(
function
()
{
start
();
});
server
.
respond
();
});
/////////////////////////////////////////////////////////////////
// declareJS
/////////////////////////////////////////////////////////////////
...
...
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