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
e2f63b29
Commit
e2f63b29
authored
Sep 04, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Interaction tests.
Split tests into folders. Clean up unused (not implemented) API.
parent
b2b89799
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
53 deletions
+112
-53
OfficeJS/src/renderjs/renderjs.js
OfficeJS/src/renderjs/renderjs.js
+1
-9
OfficeJS/src/renderjs/test/interactions/A.html
OfficeJS/src/renderjs/test/interactions/A.html
+10
-0
OfficeJS/src/renderjs/test/interactions/B.html
OfficeJS/src/renderjs/test/interactions/B.html
+11
-0
OfficeJS/src/renderjs/test/interactions/index.html
OfficeJS/src/renderjs/test/interactions/index.html
+24
-0
OfficeJS/src/renderjs/test/loading/test-gadget.html
OfficeJS/src/renderjs/test/loading/test-gadget.html
+0
-0
OfficeJS/src/renderjs/test/renderjs_test.js
OfficeJS/src/renderjs/test/renderjs_test.js
+66
-44
No files found.
OfficeJS/src/renderjs/renderjs.js
View file @
e2f63b29
...
...
@@ -441,13 +441,6 @@ var RenderJs = (function () {
}
);
return
result
;
},
getSelf
:
function
()
{
/*
* Return Gadget's Javascript representation
*/
// XXX:
}
};
}()),
...
...
@@ -489,8 +482,7 @@ var RenderJs = (function () {
var
source
,
source_gadget_id
,
source_method_id
,
source_gadget
,
destination
,
destination_gadget_id
,
destination_method_id
,
destination_gadget
,
original_source_method_id
,
func_body
,
func
;
original_source_method_id
;
source
=
$
(
value
).
attr
(
"
source
"
).
split
(
"
.
"
);
source_gadget_id
=
source
[
0
];
source_method_id
=
source
[
1
];
...
...
OfficeJS/src/renderjs/test/interactions/A.html
0 → 100644
View file @
e2f63b29
<div>
A (gadget)
</div>
<script
type=
"text/javascript"
language=
"javascript"
>
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
);
gadget
.
inc
=
function
(){
counter
=
counter
+
1
;};
});
//]]>
</script>
\ No newline at end of file
OfficeJS/src/renderjs/test/interactions/B.html
0 → 100644
View file @
e2f63b29
<div>
B (gadget)
</div>
<script
type=
"text/javascript"
language=
"javascript"
>
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
B
"
);
gadget
.
inc
=
function
(){
counter
=
counter
+
1
};
gadget
.
htmlEvent1
=
function
(){
counter
=
counter
+
1
;};
});
//]]>
</script>
\ No newline at end of file
OfficeJS/src/renderjs/test/interactions/index.html
0 → 100644
View file @
e2f63b29
<div
id=
"A"
data-gadget=
"interactions/A.html"
data-gadget-cacheable=
"0"
data-gadget-cache-id=
"A"
></div>
<div
id=
"B"
data-gadget=
"interactions/B.html"
data-gadget-cacheable=
"0"
data-gadget-cache-id=
"B"
></div>
<div
data-gadget=
""
id=
"main-interactor"
>
<connect
source=
"A.inc"
destination=
"B.inc"
></connect>
<connect
source=
"A.htmlEvent1"
destination=
"B.htmlEvent1"
></connect>
</div>
OfficeJS/src/renderjs/test/test-gadget.html
→
OfficeJS/src/renderjs/test/
loading/
test-gadget.html
View file @
e2f63b29
File moved
OfficeJS/src/renderjs/test/renderjs_test.js
View file @
e2f63b29
/*
* RenderJs tests
*/
counter
=
0
;
function
cleanUp
()
{
/*
* Clean up namespace between tests
*/
// re-init GadgetIndex
$
.
each
(
RenderJs
.
GadgetIndex
.
getGadgetList
(),
function
()
{
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
});
}
function
setupRenderJSTest
(){
/*
...
...
@@ -16,12 +27,8 @@ function setupRenderJSTest(){
module
(
"
GadgetIndex
"
);
test
(
'
GadgetIndex
'
,
function
()
{
// re-init GadgetIndex
$
.
each
(
RenderJs
.
GadgetIndex
.
getGadgetList
(),
function
()
{
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
});
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new">XXXXXXXXXXXX</div>
'
);
cleanUp
();
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new">X</div>
'
);
RenderJs
.
bootstrap
(
$
(
"
#qunit-fixture
"
));
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
(){
RenderJs
.
update
(
$
(
"
#qunit-fixture
"
));
...
...
@@ -39,31 +46,46 @@ function setupRenderJSTest(){
equal
(
RenderJs
.
GadgetIndex
.
getGadgetList
().
length
,
0
);
});
module
(
"
TabularGadget
"
);
test
(
'
addNewTabGadget
'
,
function
()
{
RenderJs
.
TabbularGadget
.
addNewTabGadget
(
"
qunit-fixture
"
,
"
test-gadget.html
"
,
""
,
""
);
module
(
"
addGadget
"
);
test
(
'
addGadget
'
,
function
()
{
cleanUp
();
RenderJs
.
addGadget
(
"
qunit-fixture
"
,
"
loading/test-gadget.html
"
,
""
,
""
);
equal
(
$
(
"
#qunit-fixture
"
).
children
(
"
.gadget
"
).
length
,
1
);
equal
(
RenderJs
.
GadgetIndex
.
getGadgetList
().
length
,
1
);
});
module
(
"
GadgetInitialization
"
);
test
(
'
GadgetInitialization
'
,
function
()
{
// re-init GadgetIndex
$
.
each
(
RenderJs
.
GadgetIndex
.
getGadgetList
(),
function
()
{
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
});
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new-init" data-gadget-property="{"name": "Ivan", "age": 33}">XXXXXXXXXXXX</div>
'
);
cleanUp
();
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new-init" data-gadget-property="{"name": "Ivan", "age": 33}">X</div>
'
);
RenderJs
.
bootstrap
(
$
(
"
#qunit-fixture
"
));
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
(){
RenderJs
.
update
(
$
(
"
#qunit-fixture
"
));
});
// test that gadget get a proper initialization from data-gadget-property
equal
(
'
Ivan
'
,
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
new-init
"
).
name
);
equal
(
33
,
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
new-init
"
).
age
);
});
// XXX: test InteractionGadget
module
(
"
InteractionGadget
"
);
test
(
'
InteractionGadget
'
,
function
()
{
cleanUp
();
RenderJs
.
addGadget
(
"
qunit-fixture
"
,
"
interactions/index.html
"
,
""
,
""
);
stop
();
// we need to wait for all gadgets loading ...
window
.
setTimeout
(
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));
start
();
equal
(
0
,
counter
);
// A.inc will call B.inc, both will increase counter by 1
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
).
inc
();
equal
(
2
,
counter
);
// fire pure HTML event on A and test it calls respective B method
$
(
'
#A
'
).
trigger
(
'
htmlEvent1
'
);
equal
(
3
,
counter
);
},
500
);
});
};
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