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
b664151b
Commit
b664151b
authored
May 26, 2014
by
Thibaut Frain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added svg_edit tests
parent
dbfcc252
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
0 deletions
+110
-0
src/svg_edit/test.html
src/svg_edit/test.html
+34
-0
src/svg_edit/test.js
src/svg_edit/test.js
+76
-0
No files found.
src/svg_edit/test.html
0 → 100644
View file @
b664151b
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, height=device-height"
/>
<title>
Test svgedit gadget
</title>
<link
rel=
"stylesheet"
href=
"../<%= copy.qunitcss.relative_dest %>"
>
<script
src=
"../<%= curl.jquery.relative_dest %>"
></script>
<script
src=
"../<%= copy.qunitjs.relative_dest %>"
></script>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
></script>
<script
src=
"test.js"
></script>
</head>
<body>
<div
id=
"qunit"
></div>
<div
id=
"qunit-fixture"
></div>
<div
id=
"svgedit-fixtures"
>
<div
id=
"fixture-1"
style=
"display: none;"
>
<svg
width=
"640"
height=
"480"
xmlns=
"http://www.w3.org/2000/svg"
>
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>
Layer 1
</title>
<rect
fill=
"#FF0000"
stroke=
"#000000"
stroke-width=
"5"
x=
"109"
y=
"174"
width=
"287"
height=
"54"
id=
"svg_1"
/>
<rect
fill=
"#FF0000"
stroke=
"#000000"
stroke-width=
"5"
x=
"393"
y=
"121"
width=
"99"
height=
"222"
id=
"svg_2"
/>
</g>
</svg>
</div>
</div>
</body>
</html>
src/svg_edit/test.js
0 → 100644
View file @
b664151b
/*global window, document, QUnit, jQuery, rJS, sinon, XMLSerializer */
/*jslint indent: 2, maxerr: 3, maxlen: 79 */
(
function
(
window
,
$
,
QUnit
,
rJS
)
{
"
use strict
"
;
QUnit
.
config
.
testTimeout
=
1000
;
var
asyncTest
=
QUnit
.
asyncTest
,
start
=
QUnit
.
start
,
ok
=
QUnit
.
ok
,
svgeditGadgetURL
=
'
index.html
'
;
function
iframeSelector
(
selectorString
)
{
return
$
(
'
iframe
'
).
contents
().
find
(
selectorString
);
}
rJS
(
window
).
ready
(
function
(
g
)
{
var
gadget_context
=
document
.
getElementById
(
'
qunit-fixture
'
);
asyncTest
(
"
[svgedit gadget] loading (iframed)
"
,
1
,
function
()
{
g
.
declareGadget
(
svgeditGadgetURL
,
{
sandbox
:
"
iframe
"
,
element
:
gadget_context
})
.
then
(
function
()
{
ok
(
iframeSelector
(
"
svg
"
)[
0
]);
})
.
always
(
start
);
});
asyncTest
(
"
[svgedit gadget] initial textarea (iframed)
"
,
1
,
function
()
{
g
.
declareGadget
(
svgeditGadgetURL
,
{
sandbox
:
"
iframe
"
,
element
:
gadget_context
})
.
then
(
function
(
gadget
)
{
return
gadget
.
getContent
();
})
.
then
(
function
(
content
)
{
ok
(
content
.
indexOf
(
'
Layer 1
'
)
!==
-
1
);
})
.
always
(
start
);
});
asyncTest
(
"
[svgedit gadget] clear content (iframed)
"
,
2
,
function
()
{
var
gadget
;
g
.
declareGadget
(
svgeditGadgetURL
,
{
sandbox
:
"
iframe
"
,
element
:
gadget_context
})
.
then
(
function
(
g
)
{
gadget
=
g
;
gadget
.
setContent
(
$
(
"
#svgedit-fixtures #fixture-1
"
).
html
())
.
then
(
gadget
.
getContent
)
.
then
(
function
(
content
)
{
ok
(
content
.
indexOf
(
'
rect
'
)
!==
-
1
);
})
.
then
(
gadget
.
clearContent
)
.
then
(
gadget
.
getContent
)
.
then
(
function
(
content
)
{
ok
(
content
.
indexOf
(
'
rect
'
)
===
-
1
);
})
.
always
(
start
);
});
});
asyncTest
(
"
[svgedit gadget] set/get content (iframed)
"
,
1
,
function
()
{
var
gadget
;
g
.
declareGadget
(
svgeditGadgetURL
,
{
sandbox
:
"
iframe
"
,
element
:
gadget_context
})
.
then
(
function
(
g
)
{
gadget
=
g
;
g
.
setContent
(
$
(
"
#svgedit-fixtures #fixture-1
"
).
html
())
.
then
(
gadget
.
getContent
)
.
then
(
function
(
content
)
{
ok
(
content
.
indexOf
(
'
rect
'
)
!==
-
1
);
})
.
always
(
start
);
});
});
});
}(
window
,
jQuery
,
QUnit
,
rJS
));
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