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
272bb541
Commit
272bb541
authored
Dec 13, 2016
by
Sebastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added last test, slight modification to renderjs itself
parent
fbb8c3fe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
3 deletions
+56
-3
renderjs.js
renderjs.js
+4
-0
test/inject_parentgadget.html
test/inject_parentgadget.html
+13
-0
test/inject_parentgadget.js
test/inject_parentgadget.js
+14
-0
test/renderjs_test.js
test/renderjs_test.js
+25
-3
No files found.
renderjs.js
View file @
272bb541
...
...
@@ -9,6 +9,10 @@
Node
,
FileReader
,
Blob
,
navigator
,
Event
,
URL
)
{
"
use strict
"
;
if
(
window
.
hasOwnProperty
(
"
renderJS
"
))
{
return
;
}
function
readBlobAsDataURL
(
blob
)
{
var
fr
=
new
FileReader
();
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
...
...
test/inject_parentgadget.html
0 → 100644
View file @
272bb541
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<title>
Test Gadget
</title>
<script
src=
"../node_modules/rsvp/dist/rsvp-2.0.4.js"
></script>
<script
src=
"../dist/renderjs-latest.js"
></script>
<script
src=
"inject_parentgadget.js"
type=
"text/javascript"
></script>
</head>
<body>
</body>
</html>
test/inject_parentgadget.js
0 → 100644
View file @
272bb541
/*global window, rJS, jIO, FormData */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
)
{
"
use strict
"
;
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
return
gadget
.
getElement
()
.
push
(
function
(
ele
)
{
ele
.
dispatchEvent
(
new
Event
(
"
rjsready
"
));
});
});
}(
window
,
rJS
));
test/renderjs_test.js
View file @
272bb541
...
...
@@ -5433,6 +5433,7 @@
test
(
'
check manual bootstrap
'
,
function
()
{
var
fixture
=
document
.
getElementById
(
"
qunit-fixture
"
),
rjsReadyCalled
=
false
,
iframe
;
fixture
.
innerHTML
=
"
<iframe id=renderjsIsolatedIframe
"
+
"
src='./inject_renderjs.html'></iframe>
"
;
...
...
@@ -5465,14 +5466,36 @@
});
})
.
then
(
function
()
{
var
rjsLoaded
=
iframe
.
contentWindow
.
rJS
!==
undefined
;
ok
(
iframe
.
contentWindow
.
hasOwnProperty
(
"
renderJS
"
),
"
RJS available after inject
"
);
})
.
then
(
function
()
{
// create parentGadget in iframe, then initialize RJS
var
parentDiv
=
iframe
.
contentDocument
.
createElement
(
"
div
"
),
tEle
;
parentDiv
.
setAttribute
(
"
data-gadget-url
"
,
"
./inject_parentgadget.html
"
);
iframe
.
contentDocument
.
body
.
appendChild
(
parentDiv
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
// listen for an event fired in the ready function of the parent
// gadget
parentDiv
.
addEventListener
(
"
rjsready
"
,
function
(
e
)
{
rjsReadyCalled
=
true
;
resolve
();
});
// if no event is fired within 500ms, just resolve and fail later
setTimeout
(
function
()
{
resolve
();
},
500
);
iframe
.
contentWindow
.
rJS
.
manualBootstrap
();
});
})
.
then
(
function
()
{
ok
(
rjsReadyCalled
,
"
RJS correctly bootstrapped and parent is ready
"
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
...
...
@@ -5484,4 +5507,3 @@
}(
document
,
renderJS
,
QUnit
,
sinon
,
URI
,
URL
,
Event
,
MutationObserver
));
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