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
7991fcc6
Commit
7991fcc6
authored
May 26, 2014
by
Thibaut Frain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added bootstrap_wysiwyg tests
parent
50b49c69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
0 deletions
+128
-0
src/bootstrap_wysiwyg/test.html
src/bootstrap_wysiwyg/test.html
+23
-0
src/bootstrap_wysiwyg/test.js
src/bootstrap_wysiwyg/test.js
+105
-0
No files found.
src/bootstrap_wysiwyg/test.html
0 → 100644
View file @
7991fcc6
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, height=device-height"
/>
<title>
Test Bootstrap Wysiwyg 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=
"truc"
></div>
</body>
</html>
src/bootstrap_wysiwyg/test.js
0 → 100644
View file @
7991fcc6
/*global window, document, QUnit, jQuery, rJS*/
/*jslint indent: 2, maxerr: 3, maxlen: 79 */
(
function
(
window
,
$
,
QUnit
,
rJS
)
{
"
use strict
"
;
QUnit
.
config
.
testTimeout
=
1000
;
var
asyncTest
=
QUnit
.
asyncTest
,
start
=
QUnit
.
start
,
equal
=
QUnit
.
equal
,
bwGadgetURL
=
'
index.html
'
;
function
iframeSelector
(
selectorString
)
{
return
$
(
'
iframe
'
).
contents
().
find
(
selectorString
);
}
rJS
(
window
).
ready
(
function
(
g
)
{
var
gadget_context
=
$
(
'
#qunit-fixture
'
)[
0
];
asyncTest
(
"
Bootstrap wysiwyg loading
"
,
1
,
function
()
{
g
.
declareGadget
(
bwGadgetURL
,
{
element
:
gadget_context
,
sandbox
:
'
iframe
'
})
.
then
(
function
()
{
var
edattr
=
iframeSelector
(
"
.editor
"
).
attr
(
'
contenteditable
'
);
equal
(
edattr
,
"
true
"
);
})
.
always
(
start
);
});
asyncTest
(
"
Bootstrap wysiwyg loading : textarea is empty
"
,
1
,
function
()
{
g
.
declareGadget
(
bwGadgetURL
,
{
element
:
gadget_context
,
sandbox
:
'
iframe
'
})
.
then
(
function
()
{
var
ed
=
iframeSelector
(
"
.editor
"
);
equal
(
ed
.
html
(),
""
);
})
.
always
(
start
);
});
asyncTest
(
"
clear content of editor
"
,
1
,
function
()
{
g
.
declareGadget
(
bwGadgetURL
,
{
element
:
gadget_context
,
sandbox
:
'
iframe
'
})
.
then
(
function
(
gadget
)
{
iframeSelector
(
'
.editor
'
).
html
(
'
A value
'
);
return
gadget
;
})
.
then
(
function
(
gadget
)
{
return
gadget
.
clearContent
().
then
(
function
()
{
equal
(
iframeSelector
(
'
.editor
'
).
text
(),
""
);
});
})
.
always
(
start
);
});
asyncTest
(
"
get content of editor
"
,
1
,
function
()
{
g
.
declareGadget
(
bwGadgetURL
,
{
element
:
gadget_context
,
sandbox
:
'
iframe
'
})
.
then
(
function
(
gadget
)
{
iframeSelector
(
'
.editor
'
).
html
(
'
A value
'
);
return
gadget
;
})
.
then
(
function
(
gadget
)
{
return
gadget
.
getContent
().
then
(
function
(
content
)
{
equal
(
content
,
"
A value
"
);
});
})
.
always
(
start
);
});
asyncTest
(
"
set content of sheet
"
,
2
,
function
()
{
var
gadget
,
content
;
g
.
declareGadget
(
bwGadgetURL
,
{
element
:
gadget_context
,
sandbox
:
'
iframe
'
})
.
then
(
function
(
gd
)
{
iframeSelector
(
'
.editor
'
).
html
(
'
A value
'
);
gadget
=
gd
;
return
gadget
.
getContent
();
})
.
then
(
function
(
c
)
{
content
=
c
;
return
gadget
.
clearContent
();
})
.
then
(
function
()
{
equal
(
iframeSelector
(
'
.editor
'
).
text
(),
""
);
return
gadget
.
setContent
(
content
);
})
.
then
(
function
()
{
equal
(
iframeSelector
(
'
.editor
'
).
text
(),
"
A value
"
);
})
.
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