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
098ce602
Commit
098ce602
authored
Mar 16, 2017
by
Sebastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated manual-inject tests to conform with naming conventions
parent
5c43f74a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
14 deletions
+15
-14
test/inject_script.html
test/inject_script.html
+1
-1
test/inject_script.js
test/inject_script.js
+2
-2
test/renderjs_test.js
test/renderjs_test.js
+9
-8
test/trigger_rjsready_event_on_ready_gadget.html
test/trigger_rjsready_event_on_ready_gadget.html
+1
-1
test/trigger_rjsready_event_on_ready_gadget.js
test/trigger_rjsready_event_on_ready_gadget.js
+2
-2
No files found.
test/inject_
renderjs
.html
→
test/inject_
script
.html
View file @
098ce602
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd">
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<html>
<head>
<head>
<script
src=
"./inject_
renderjs
.js"
></script>
<script
src=
"./inject_
script
.js"
></script>
</head>
</head>
<body></body>
<body></body>
</html>
</html>
test/inject_
renderjs
.js
→
test/inject_
script
.js
View file @
098ce602
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
// can't use RSVP here because its not loaded (neccessarily)
// can't use RSVP here because its not loaded (neccessarily)
function
test_inject_lib
(
lib
src
,
resolve
)
{
function
inject_script
(
src
,
resolve
)
{
// inject RSVP
// inject RSVP
var
script
=
document
.
createElement
(
"
script
"
);
var
script
=
document
.
createElement
(
"
script
"
);
script
.
onload
=
function
()
{
script
.
onload
=
function
()
{
resolve
();
resolve
();
};
};
script
.
src
=
lib
src
;
script
.
src
=
src
;
document
.
body
.
appendChild
(
script
);
document
.
body
.
appendChild
(
script
);
}
}
test/renderjs_test.js
View file @
098ce602
...
@@ -5433,10 +5433,11 @@
...
@@ -5433,10 +5433,11 @@
test
(
'
check manual bootstrap
'
,
function
()
{
test
(
'
check manual bootstrap
'
,
function
()
{
var
fixture
=
document
.
getElementById
(
"
qunit-fixture
"
),
var
fixture
=
document
.
getElementById
(
"
qunit-fixture
"
),
rjsReadyCalled
=
false
,
iframe
;
iframe
;
// The iframe for an isolated renderjs-free environment
// to test the manual inject
fixture
.
innerHTML
=
"
<iframe id=renderjsIsolatedIframe
"
+
fixture
.
innerHTML
=
"
<iframe id=renderjsIsolatedIframe
"
+
"
src='./inject_
renderjs
.html'></iframe>
"
;
"
src='./inject_
script
.html'></iframe>
"
;
iframe
=
document
.
getElementById
(
"
renderjsIsolatedIframe
"
);
iframe
=
document
.
getElementById
(
"
renderjsIsolatedIframe
"
);
stop
();
stop
();
...
@@ -5451,7 +5452,7 @@
...
@@ -5451,7 +5452,7 @@
"
RJS NOT available before inject
"
"
RJS NOT available before inject
"
);
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
iframe
.
contentWindow
.
test_inject_lib
(
iframe
.
contentWindow
.
inject_script
(
"
../node_modules/rsvp/dist/rsvp-2.0.4.js
"
,
"
../node_modules/rsvp/dist/rsvp-2.0.4.js
"
,
resolve
resolve
);
);
...
@@ -5459,7 +5460,7 @@
...
@@ -5459,7 +5460,7 @@
})
})
.
then
(
function
()
{
.
then
(
function
()
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
iframe
.
contentWindow
.
test_inject_lib
(
iframe
.
contentWindow
.
inject_script
(
"
../dist/renderjs-latest.js
"
,
"
../dist/renderjs-latest.js
"
,
resolve
resolve
);
);
...
@@ -5476,25 +5477,24 @@
...
@@ -5476,25 +5477,24 @@
var
parentDiv
=
iframe
.
contentDocument
.
createElement
(
"
div
"
);
var
parentDiv
=
iframe
.
contentDocument
.
createElement
(
"
div
"
);
parentDiv
.
setAttribute
(
parentDiv
.
setAttribute
(
"
data-gadget-url
"
,
"
data-gadget-url
"
,
"
./
inject_parent
gadget.html
"
"
./
trigger_rjsready_event_on_ready_
gadget.html
"
);
);
iframe
.
contentDocument
.
body
.
appendChild
(
parentDiv
);
iframe
.
contentDocument
.
body
.
appendChild
(
parentDiv
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
// listen for an event fired in the ready function of the parent
// listen for an event fired in the ready function of the parent
// gadget
// gadget
parentDiv
.
addEventListener
(
"
rjsready
"
,
function
(
e
)
{
parentDiv
.
addEventListener
(
"
rjsready
"
,
function
(
e
)
{
rjsReadyCalled
=
true
;
resolve
();
resolve
();
});
});
// if no event is fired within 500ms, just resolve and fail later
// if no event is fired within 500ms, just resolve and fail later
window
.
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
re
solve
(
);
re
ject
(
"
Timeout, RenderJS is not Ready
"
);
},
500
);
},
500
);
iframe
.
contentWindow
.
rJS
.
manualBootstrap
();
iframe
.
contentWindow
.
rJS
.
manualBootstrap
();
});
});
})
})
.
then
(
function
()
{
.
then
(
function
()
{
ok
(
rjsReadyCalled
,
"
RJS correctly bootstrapped and parent is ready
"
);
ok
(
true
,
"
RJS correctly bootstrapped and parent is ready
"
);
})
})
.
fail
(
function
(
error
)
{
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
ok
(
false
,
error
);
...
@@ -5506,3 +5506,4 @@
...
@@ -5506,3 +5506,4 @@
}(
document
,
renderJS
,
QUnit
,
sinon
,
URI
,
URL
,
Event
,
}(
document
,
renderJS
,
QUnit
,
sinon
,
URI
,
URL
,
Event
,
MutationObserver
));
MutationObserver
));
test/
inject_parent
gadget.html
→
test/
trigger_rjsready_event_on_ready_
gadget.html
View file @
098ce602
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<script
src=
"../node_modules/rsvp/dist/rsvp-2.0.4.js"
></script>
<script
src=
"../node_modules/rsvp/dist/rsvp-2.0.4.js"
></script>
<script
src=
"../dist/renderjs-latest.js"
></script>
<script
src=
"../dist/renderjs-latest.js"
></script>
<script
src=
"
inject_parent
gadget.js"
type=
"text/javascript"
></script>
<script
src=
"
trigger_rjsready_event_on_ready_
gadget.js"
type=
"text/javascript"
></script>
</head>
</head>
<body>
<body>
</body>
</body>
...
...
test/
inject_parent
gadget.js
→
test/
trigger_rjsready_event_on_ready_
gadget.js
View file @
098ce602
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
.
ready
(
function
(
gadget
)
{
return
gadget
.
getElement
()
return
gadget
.
getElement
()
.
push
(
function
(
ele
)
{
.
push
(
function
(
ele
ment
)
{
ele
.
dispatchEvent
(
new
Event
(
"
rjsready
"
));
ele
ment
.
dispatchEvent
(
new
Event
(
"
rjsready
"
));
});
});
});
});
}(
window
,
rJS
));
}(
window
,
rJS
));
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