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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
renderjs
Commits
67bcae7a
Commit
67bcae7a
authored
May 22, 2014
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set some data attribute on gadget element.
Only ease to ease developper comprehension.
parent
2cdfe26b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
renderjs.js
renderjs.js
+7
-0
test/renderjs_test.js
test/renderjs_test.js
+16
-2
No files found.
renderjs.js
View file @
67bcae7a
...
...
@@ -423,8 +423,15 @@
// Store local reference to the gadget instance
if
(
options
.
scope
!==
undefined
)
{
parent_gadget
.
__sub_gadget_dict
[
options
.
scope
]
=
gadget_instance
;
gadget_instance
.
__element
.
setAttribute
(
"
data-gadget-scope
"
,
options
.
scope
);
}
// Put some attribute to ease page layout comprehension
gadget_instance
.
__element
.
setAttribute
(
"
data-gadget-url
"
,
url
);
gadget_instance
.
__element
.
setAttribute
(
"
data-gadget-sandbox
"
,
options
.
sandbox
);
return
gadget_instance
;
});
return
queue
;
...
...
test/renderjs_test.js
View file @
67bcae7a
...
...
@@ -1835,8 +1835,16 @@
.
then
(
function
(
new_gadget
)
{
equal
(
document
.
getElementById
(
'
qunit-fixture
'
).
innerHTML
,
"
<div>youhou2</div><div>bar</div>
"
);
equal
(
new_gadget
.
__element
.
outerHTML
,
"
<div><p>Bar content</p></div>
"
);
equal
(
new_gadget
.
__element
.
innerHTML
,
"
<p>Bar content</p>
"
);
equal
(
new_gadget
.
__element
.
tagName
,
"
DIV
"
);
equal
(
new_gadget
.
__element
.
getAttribute
(
"
data-gadget-url
"
),
html_url
);
equal
(
new_gadget
.
__element
.
getAttribute
(
"
data-gadget-sandbox
"
),
"
public
"
);
equal
(
new_gadget
.
__element
.
getAttribute
(
"
data-gadget-scope
"
),
null
);
ok
(
spy_js
.
calledTwice
,
"
JS count
"
+
spy_js
.
callCount
);
equal
(
spy_js
.
firstCall
.
args
[
0
],
js1_url
,
"
First JS call
"
);
equal
(
spy_js
.
secondCall
.
args
[
0
],
js2_url
,
"
Second JS call
"
);
...
...
@@ -2200,6 +2208,8 @@
.
then
(
function
(
child_gadget
)
{
ok
(
gadget
.
__sub_gadget_dict
.
hasOwnProperty
(
"
foo
"
));
equal
(
gadget
.
__sub_gadget_dict
.
foo
,
child_gadget
);
equal
(
child_gadget
.
__element
.
getAttribute
(
"
data-gadget-scope
"
),
"
foo
"
);
})
.
fail
(
function
(
e
)
{
ok
(
false
,
e
);
...
...
@@ -2481,6 +2491,10 @@
.
then
(
function
(
child_gadget
)
{
ok
(
gadget
.
__sub_gadget_dict
.
hasOwnProperty
(
"
foo
"
));
equal
(
gadget
.
__sub_gadget_dict
.
foo
,
child_gadget
);
equal
(
child_gadget
.
__element
.
getAttribute
(
"
data-gadget-scope
"
),
"
foo
"
);
equal
(
child_gadget
.
__element
.
getAttribute
(
"
data-gadget-sandbox
"
),
"
iframe
"
);
})
.
fail
(
function
(
e
)
{
ok
(
false
,
e
);
...
...
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