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
b2b89799
Commit
b2b89799
authored
Sep 04, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add gadget's proper initialization from data-gadget-property test.
parent
790d533a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
OfficeJS/src/renderjs/test/renderjs_test.js
OfficeJS/src/renderjs/test/renderjs_test.js
+24
-5
No files found.
OfficeJS/src/renderjs/test/renderjs_test.js
View file @
b2b89799
/*
* RenderJs tests
*/
function
setupRenderJSTest
(){
function
setupRenderJSTest
(){
/*
/*
* Main RenderJS test entry point
* Main RenderJS test entry point
*/
*/
module
(
"
Cache
"
);
module
(
"
Cache
"
);
test
(
'
Cache
'
,
function
()
{
test
(
'
Cache
'
,
function
()
{
cache_id
=
'
my_test
'
;
cache_id
=
'
my_test
'
;
data
=
{
'
gg
'
:
1
};
data
=
{
'
gg
'
:
1
};
RenderJs
.
Cache
.
set
(
cache_id
,
data
);
RenderJs
.
Cache
.
set
(
cache_id
,
data
);
...
@@ -13,12 +15,12 @@ function setupRenderJSTest(){
...
@@ -13,12 +15,12 @@ function setupRenderJSTest(){
});
});
module
(
"
GadgetIndex
"
);
module
(
"
GadgetIndex
"
);
test
(
'
GadgetIndex
'
,
function
()
{
test
(
'
GadgetIndex
'
,
function
()
{
// re-init GadgetIndex
// re-init GadgetIndex
$
.
each
(
RenderJs
.
GadgetIndex
.
getGadgetList
(),
function
()
{
$
.
each
(
RenderJs
.
GadgetIndex
.
getGadgetList
(),
function
()
{
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
});
});
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new">XXXXXXXXXXXX</div>
'
);
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="" id="new">XXXXXXXXXXXX</div>
'
);
RenderJs
.
bootstrap
(
$
(
"
#qunit-fixture
"
));
RenderJs
.
bootstrap
(
$
(
"
#qunit-fixture
"
));
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
(){
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
(){
...
@@ -38,12 +40,29 @@ function setupRenderJSTest(){
...
@@ -38,12 +40,29 @@ function setupRenderJSTest(){
});
});
module
(
"
TabularGadget
"
);
module
(
"
TabularGadget
"
);
test
(
'
addNewTabGadget
'
,
function
()
{
test
(
'
addNewTabGadget
'
,
function
()
{
RenderJs
.
TabbularGadget
.
addNewTabGadget
(
"
qunit-fixture
"
,
"
test-gadget.html
"
,
""
,
""
);
RenderJs
.
TabbularGadget
.
addNewTabGadget
(
"
qunit-fixture
"
,
"
test-gadget.html
"
,
""
,
""
);
equal
(
$
(
"
#qunit-fixture
"
).
children
(
"
.gadget
"
).
length
,
1
);
equal
(
$
(
"
#qunit-fixture
"
).
children
(
"
.gadget
"
).
length
,
1
);
equal
(
RenderJs
.
GadgetIndex
.
getGadgetList
().
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>
'
);
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
// XXX: test InteractionGadget
};
};
...
...
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