Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
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
Romain Courteaud
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 @@
...
@@ -294,16 +294,23 @@
next_loading_gadget_deferred
.
resolve
(
gadget
);
next_loading_gadget_deferred
.
resolve
(
gadget
);
}).
fail
(
function
()
{
}).
fail
(
function
()
{
// One error during css/js loading
// One error during css/js loading
next_loading_gadget_deferred
.
reject
();
next_loading_gadget_deferred
.
reject
.
apply
(
next_loading_gadget_deferred
,
arguments
);
});
});
}).
fail
(
function
()
{
}).
fail
(
function
()
{
// Failed to fetch dependencies information.
// Failed to fetch dependencies information.
next_loading_gadget_deferred
.
reject
();
next_loading_gadget_deferred
.
reject
.
apply
(
next_loading_gadget_deferred
,
arguments
);
});
});
}).
fail
(
function
()
{
}).
fail
(
function
()
{
// Klass not correctly loaded. Reject instanciation
// 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 @@
...
@@ -561,8 +568,8 @@
dfr
.
reject
(
jqXHR
,
"
Unexpected content type
"
);
dfr
.
reject
(
jqXHR
,
"
Unexpected content type
"
);
}
}
})
})
.
fail
(
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
.
fail
(
function
()
{
dfr
.
reject
(
jqXHR
,
textStatus
,
errorThrown
);
dfr
.
reject
.
apply
(
dfr
,
arguments
);
});
});
}
}
return
dfr
.
promise
();
return
dfr
.
promise
();
...
@@ -744,7 +751,8 @@
...
@@ -744,7 +751,8 @@
gadget_loading_klass
=
undefined
;
gadget_loading_klass
=
undefined
;
loading_gadget_deferred
.
resolve
();
loading_gadget_deferred
.
resolve
();
}).
fail
(
function
()
{
}).
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 @@
...
@@ -321,7 +321,9 @@
ok
(
false
,
"
text/plain should fail
"
);
ok
(
false
,
"
text/plain should fail
"
);
})
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
.
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
()
{
.
always
(
function
()
{
start
();
start
();
...
@@ -347,10 +349,11 @@
...
@@ -347,10 +349,11 @@
stop
();
stop
();
renderJS
.
declareGadgetKlass
(
url
)
renderJS
.
declareGadgetKlass
(
url
)
.
done
(
function
()
{
.
done
(
function
()
{
ok
(
false
,
"
text/plain
should fail
"
);
ok
(
false
,
"
Non parsable HTML
should fail
"
);
})
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
200
"
,
jqXHR
.
status
);
equal
(
"
200
"
,
jqXHR
.
status
);
equal
(
textStatus
,
"
HTML Parsing failed
"
);
})
})
.
always
(
function
()
{
.
always
(
function
()
{
mock
.
verify
();
mock
.
verify
();
...
@@ -455,7 +458,7 @@
...
@@ -455,7 +458,7 @@
ok
(
false
,
"
404 should fail
"
);
ok
(
false
,
"
404 should fail
"
);
})
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
404
"
,
jqXHR
.
status
);
equal
(
jqXHR
.
status
,
"
404
"
);
})
})
.
always
(
function
()
{
.
always
(
function
()
{
start
();
start
();
...
@@ -474,7 +477,7 @@
...
@@ -474,7 +477,7 @@
ok
(
false
,
"
404 should fail
"
);
ok
(
false
,
"
404 should fail
"
);
})
})
.
fail
(
function
(
jqXHR
,
textStatus
)
{
.
fail
(
function
(
jqXHR
,
textStatus
)
{
equal
(
"
404
"
,
jqXHR
.
status
);
equal
(
jqXHR
.
status
,
"
404
"
);
})
})
.
always
(
function
()
{
.
always
(
function
()
{
start
();
start
();
...
@@ -779,11 +782,34 @@
...
@@ -779,11 +782,34 @@
});
});
});
});
// test('clearGadgetKlassList leads to CSS reload', function () {
test
(
'
clearGadgetKlassList leads to CSS reload
'
,
function
()
{
// // Check that declareCSS reload the CSS
// Check that declareCSS reload the CSS
// // after clearGadgetKlassList is called
// after clearGadgetKlassList is called
// ok(false, "not implemented");
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
// RenderJSGadget.getInterfaceList
...
@@ -1309,8 +1335,8 @@
...
@@ -1309,8 +1335,8 @@
.
done
(
function
(
new_gadget
)
{
.
done
(
function
(
new_gadget
)
{
ok
(
false
);
ok
(
false
);
})
})
.
fail
(
function
()
{
.
fail
(
function
(
jqXHR
,
textStatus
)
{
ok
(
true
);
equal
(
"
404
"
,
jqXHR
.
status
);
})
})
.
always
(
function
()
{
.
always
(
function
()
{
start
();
start
();
...
@@ -1340,8 +1366,9 @@
...
@@ -1340,8 +1366,9 @@
.
done
(
function
(
new_gadget
)
{
.
done
(
function
(
new_gadget
)
{
ok
(
false
);
ok
(
false
);
})
})
.
fail
(
function
()
{
.
fail
(
function
(
jqXHR
,
textStatus
)
{
ok
(
true
);
equal
(
jqXHR
.
status
,
404
);
equal
(
textStatus
,
"
error
"
);
})
})
.
always
(
function
()
{
.
always
(
function
()
{
start
();
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