Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
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
Boris Kocherov
renderjs
Commits
a5296b81
Commit
a5296b81
authored
Jul 23, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test the ready method.
parent
5620d6c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
renderjs.js
renderjs.js
+1
-0
test/renderjs_test2.js
test/renderjs_test2.js
+44
-1
No files found.
renderjs.js
View file @
a5296b81
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
RenderJSGadget
.
ready_list
=
[];
RenderJSGadget
.
ready_list
=
[];
RenderJSGadget
.
ready
=
function
(
callback
)
{
RenderJSGadget
.
ready
=
function
(
callback
)
{
this
.
ready_list
.
push
(
callback
);
this
.
ready_list
.
push
(
callback
);
return
this
;
};
};
RenderJSGadget
.
declareMethod
=
function
(
name
,
callback
)
{
RenderJSGadget
.
declareMethod
=
function
(
name
,
callback
)
{
...
...
test/renderjs_test2.js
View file @
a5296b81
...
@@ -938,7 +938,7 @@
...
@@ -938,7 +938,7 @@
});
});
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// RenderJSGadget.declareMethod
// RenderJSGadget
Klass
.declareMethod
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
module
(
"
RenderJSGadgetKlass.declareMethod
"
);
module
(
"
RenderJSGadgetKlass.declareMethod
"
);
test
(
'
is chainable
'
,
function
()
{
test
(
'
is chainable
'
,
function
()
{
...
@@ -1053,4 +1053,47 @@
...
@@ -1053,4 +1053,47 @@
});
});
});
});
/////////////////////////////////////////////////////////////////
// RenderJSGadgetKlass.ready
/////////////////////////////////////////////////////////////////
module
(
"
RenderJSGadgetKlass.ready
"
);
test
(
'
is chainable
'
,
function
()
{
// Check that ready is chainable
// Subclass RenderJSGadget to not pollute its namespace
var
Klass
=
function
()
{
RenderJSGadget
.
call
(
this
);
},
gadget
,
result
;
Klass
.
prototype
=
new
RenderJSGadget
();
Klass
.
prototype
.
constructor
=
Klass
;
Klass
.
ready_list
=
[];
Klass
.
ready
=
RenderJSGadget
.
ready
;
gadget
=
new
Klass
();
result
=
Klass
.
ready
(
function
()
{
var
a
;
});
// ready is chainable
equal
(
result
,
Klass
);
});
test
(
'
store callback in the ready_list property
'
,
function
()
{
// Check that ready is chainable
// Subclass RenderJSGadget to not pollute its namespace
var
Klass
=
function
()
{
RenderJSGadget
.
call
(
this
);
},
gadget
,
result
,
callback
=
function
()
{
var
a
;
};
Klass
.
prototype
=
new
RenderJSGadget
();
Klass
.
prototype
.
constructor
=
Klass
;
Klass
.
ready_list
=
[];
Klass
.
ready
=
RenderJSGadget
.
ready
;
gadget
=
new
Klass
();
Klass
.
ready
(
callback
);
// ready is chainable
deepEqual
(
Klass
.
ready_list
,
[
callback
]);
});
}(
document
,
jQuery
,
renderJS
,
QUnit
,
sinon
));
}(
document
,
jQuery
,
renderJS
,
QUnit
,
sinon
));
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