Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
9f8f1eeb
Commit
9f8f1eeb
authored
Sep 05, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editor spec
parent
1351d4b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
editor.range.js
spec/module/editor.range.js
+47
-0
editor.receiver.js
spec/module/editor.receiver.js
+31
-0
No files found.
spec/module/editor.range.js
0 → 100644
View file @
9f8f1eeb
describe
(
"editor.range"
,
function
()
{
var
_div
=
document
.
createElement
(
'div'
);
_div
.
setAttribute
(
'contenteditable'
,
true
);
var
range
=
new
KM
.
Minder
.
Range
(
_div
);
describe
(
"getStartOffset"
,
function
(){
_div
.
innerHTML
=
'xxx<br
\
/><br
\
/>xxx<br
\
/>'
;
it
(
"选区在容器上"
,
function
()
{
range
.
startContainer
=
_div
;
range
.
startOffset
=
2
;
expect
(
range
.
getStartOffset
()).
toBe
(
4
);
});
it
(
"选区在文本节点上"
,
function
()
{
range
.
startContainer
=
_div
.
childNodes
[
3
];
range
.
startOffset
=
2
;
expect
(
range
.
getStartOffset
()).
toBe
(
7
);
});
});
describe
(
"setStartOffset"
,
function
(){
_div
.
innerHTML
=
'sdfsdfsdfsdf<br><br>sdf3<br>23232<br>'
;
it
(
"选区在容器上"
,
function
()
{
range
.
container
=
_div
;
debugger
range
.
setStartOffset
(
26
);
expect
(
range
.
startContainer
).
toBe
(
_div
);
});
// it("选区在文本节点上", function () {
//
// range.startContainer = _div.childNodes[3];
// range.startOffset = 2;
// expect(range.getStartOffset()).toBe(7);
// });
})
});
spec/module/editor.receiver.js
0 → 100644
View file @
9f8f1eeb
describe
(
"editor.receiver"
,
function
()
{
debugger
var
_div
=
window
.
document
.
createElement
(
'div'
);
_div
.
id
=
"testDiv"
;
var
km
=
KM
.
getMinder
(
'testDiv'
);
var
sel
=
new
KM
.
Minder
.
Selection
();
var
range
=
new
KM
.
Minder
.
Range
();
var
receiver
=
new
KM
.
Minder
.
Receiver
(
this
,
sel
,
range
);
describe
(
"getStartOffset"
,
function
(){
//
// _div.innerHTML = 'xxx<br\/><br\/>xxx<br\/>';
// it("选区在容器上", function () {
//
// range.startContainer = _div;
// range.startOffset = 2;
// expect(range.getStartOffset()).toBe(4);
// });
// it("选区在文本节点上", function () {
//
// range.startContainer = _div.childNodes[3];
// range.startOffset = 2;
// expect(range.getStartOffset()).toBe(7);
// });
})
});
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