Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
a7997708
Commit
a7997708
authored
Sep 05, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure Gadget's ready event works. Add test for it.
Use ready event in example instead of hard coded timeouts.
parent
c72fbd99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
OfficeJS/src/renderjs/examples/interactions/index.html
OfficeJS/src/renderjs/examples/interactions/index.html
+3
-7
OfficeJS/src/renderjs/renderjs.js
OfficeJS/src/renderjs/renderjs.js
+5
-3
OfficeJS/src/renderjs/test/renderjs_test.js
OfficeJS/src/renderjs/test/renderjs_test.js
+18
-3
No files found.
OfficeJS/src/renderjs/examples/interactions/index.html
View file @
a7997708
...
...
@@ -35,13 +35,9 @@
<script
type=
"text/javascript"
language=
"javascript"
>
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
// XXX: using setTimeout is ugly, see non working example below to be fixed
window
.
setTimeout
(
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));},
1000
);
// RenderJs.GadgetIndex.getRootGadget().getDom().bind("ready", function () {
// RenderJs.InteractionGadget.bind($("#main-interactor"));});
});
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));});
});
//]]>
</script>
...
...
OfficeJS/src/renderjs/renderjs.js
View file @
a7997708
...
...
@@ -28,7 +28,11 @@ var RenderJs = (function () {
return
{
bootstrap
:
function
(
root
)
{
/* initial load application gadget */
RenderJs
.
loadGadgetFromUrl
(
root
);
gadget_id
=
root
.
attr
(
"
id
"
);
if
(
gadget_id
!==
undefined
)
{
// bootstart root gadget only if it is indeed a gadget
RenderJs
.
loadGadgetFromUrl
(
root
);
}
RenderJs
.
load
(
root
);
},
...
...
@@ -55,7 +59,6 @@ var RenderJs = (function () {
app_cache
,
data
,
gadget_js
;
url
=
gadget
.
attr
(
"
data-gadget
"
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
// register gadget in javascript namespace
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
...
...
@@ -152,7 +155,6 @@ var RenderJs = (function () {
trigger
(
"
ready
"
);
RenderJs
.
setReady
(
true
);
}
//is_ready = true;
}
return
is_gadget_list_loaded
;
},
...
...
OfficeJS/src/renderjs/test/renderjs_test.js
View file @
a7997708
...
...
@@ -77,7 +77,7 @@ function setupRenderJSTest(){
stop
();
// we need to wait for all gadgets loading ...
window
.
setTimeout
(
function
()
{
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));
start
();
equal
(
0
,
counter
);
...
...
@@ -86,8 +86,23 @@ function setupRenderJSTest(){
equal
(
2
,
counter
);
// fire pure HTML event on A and test it calls respective B method
$
(
'
#A
'
).
trigger
(
'
htmlEvent1
'
);
equal
(
3
,
counter
);
},
500
);
equal
(
3
,
counter
);
});
});
module
(
"
GadgetReadyEvent
"
);
test
(
'
GadgetReadyEvent
'
,
function
()
{
cleanUp
();
RenderJs
.
addGadget
(
"
qunit-fixture
"
,
"
interactions/index.html
"
,
""
,
""
);
stop
();
// we need to wait for all gadgets loading ...
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
start
();
equal
(
true
,
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
());
equal
(
true
,
RenderJs
.
isReady
());
});
});
};
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