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
8dd12afd
Commit
8dd12afd
authored
Oct 25, 2013
by
Thibaut Frain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Bootstrap wysiwyg tests and tests passed
parent
2056f6ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
0 deletions
+121
-0
test/bw-gadget-test.html
test/bw-gadget-test.html
+23
-0
test/bw-gadget-test.js
test/bw-gadget-test.js
+98
-0
No files found.
test/bw-gadget-test.html
0 → 100644
View file @
8dd12afd
<!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=
"../src/lib/qunit/qunit.css"
>
<script
src=
"../src/lib/jquery.js"
></script>
<script
src=
"../src/lib/qunit/qunit.js"
></script>
<script
src=
"../src/lib/sinon/sinon.js"
></script>
<script
src=
"../src/lib/jschannel.js"
></script>
<script
src=
"../src/lib/renderjs.js"
></script>
<script
src=
"bw-gadget-test.js"
></script>
</head>
<body>
<div
id=
"qunit"
></div>
<div
id=
"qunit-fixture"
></div>
<div
id=
"gadget"
style=
"display:none;"
></div>
</body>
</html>
test/bw-gadget-test.js
0 → 100644
View file @
8dd12afd
/*global window, document, QUnit, jQuery, rJS, sinon */
/*jslint indent: 2, maxerr: 3, maxlen: 79 */
"
use strict
"
;
QUnit
.
config
.
testTimeout
=
1000
;
(
function
(
window
,
$
,
QUnit
,
rJS
)
{
//var test = QUnit.test,
var
asyncTest
=
QUnit
.
asyncTest
,
//stop = QUnit.stop,
start
=
QUnit
.
start
,
//ok = QUnit.ok,
equal
=
QUnit
.
equal
,
//expect = QUnit.expect,
//throws = QUnit.throws,
//deepEqual = QUnit.deepEqual;
bwGadgetURL
=
'
../deploy/gadget/bootstrap-wysiwyg.html
'
;
function
iframeSelector
(
selectorString
)
{
return
$
(
'
iframe
'
).
contents
().
find
(
selectorString
);
}
rJS
(
window
).
ready
(
function
()
{
var
g
=
rJS
(
this
),
gadget_context
=
g
.
context
.
find
(
'
#gadget
'
).
first
();
asyncTest
(
"
Bootstrap wysiwyg loading
"
,
1
,
function
()
{
g
.
declareIframedGadget
(
bwGadgetURL
,
gadget_context
)
.
then
(
function
()
{
var
edattr
=
iframeSelector
(
"
#editor
"
).
attr
(
'
contenteditable
'
);
equal
(
edattr
,
"
true
"
);
})
.
always
(
start
);
});
asyncTest
(
"
Bootstrap wysiwyg loading : textarea is empty
"
,
1
,
function
()
{
g
.
declareIframedGadget
(
bwGadgetURL
,
gadget_context
)
.
then
(
function
()
{
var
ed
=
iframeSelector
(
"
#editor
"
);
equal
(
ed
.
html
(),
""
);
})
.
always
(
start
);
});
asyncTest
(
"
clear content of editor
"
,
1
,
function
()
{
g
.
declareIframedGadget
(
bwGadgetURL
,
gadget_context
)
.
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
.
declareIframedGadget
(
bwGadgetURL
,
gadget_context
)
.
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
.
declareIframedGadget
(
bwGadgetURL
,
gadget_context
)
.
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