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
bb44a06f
Commit
bb44a06f
authored
Feb 12, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec
parent
484331d1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
17 deletions
+99
-17
.jshintrc
.jshintrc
+1
-0
.jshintrc
spec/.jshintrc
+28
-0
json.js
spec/protocal/json.js
+0
-0
plain.js
spec/protocal/plain.js
+50
-0
keyboard.js
src/module/keyboard.js
+20
-17
No files found.
.jshintrc
View file @
bb44a06f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
"MinderEvent",
"MinderEvent",
"Command",
"Command",
"KITYMINDER_CONFIG",
"KITYMINDER_CONFIG",
"keymap",
"Utils",
"Utils",
"utils"
"utils"
]
]
...
...
spec/.jshintrc
0 → 100644
View file @
bb44a06f
{
"undef" : true,
"unused" : false,
"strict" : false,
"curly" : false,
"newcap" : true,
"trailing" : true,
"white": false,
"quotmark": false,
"predef" : [
"require",
"console",
"kity",
"KityMinder",
"KM",
"Minder",
"MinderNode",
"MinderEvent",
"Command",
"KITYMINDER_CONFIG",
"Utils",
"utils",
"describe",
"it",
"beforeEach",
"expect"
]
}
\ No newline at end of file
spec/protocal/json.js
0 → 100644
View file @
bb44a06f
spec/protocal/plain.js
0 → 100644
View file @
bb44a06f
describe
(
"protocal/plain"
,
function
()
{
var
json
,
local
,
protocal
;
beforeEach
(
function
()
{
protocal
=
KM
.
findProtocal
(
'plain'
);
}
);
it
(
'协议存在'
,
function
()
{
expect
(
protocal
).
toBeDefined
();
}
);
it
(
'正确 encode'
,
function
()
{
json
=
{
data
:
{
text
:
'root'
,
anyway
:
'omg'
},
children
:
[
{
data
:
{
text
:
'l1c1'
}
},
{
data
:
{
text
:
'l1c2'
},
children
:
[
{
data
:
{
text
:
'l2c1'
}
},
{
data
:
{
text
:
'l2c2'
}
}
]
},
{
data
:
{
text
:
'l1c3'
}
}
]
};
local
=
protocal
.
encode
(
json
);
expect
(
local
).
toBe
(
'root
\
n'
+
'
\
tl1c1
\
n'
+
'
\
tl1c2
\
n'
+
'
\
t
\
tl2c1
\
n'
+
'
\
t
\
tl2c2
\
n'
+
'
\
tl1c3
\
n'
);
}
);
}
);
\ No newline at end of file
src/module/keyboard.js
View file @
bb44a06f
...
@@ -47,7 +47,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
...
@@ -47,7 +47,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
}
}
function
KBNavigate
(
km
,
direction
)
{
function
navigateTo
(
km
,
direction
)
{
var
nextNode
=
km
.
getSelectedNode
().
_nearestNodes
[
direction
];
var
nextNode
=
km
.
getSelectedNode
().
_nearestNodes
[
direction
];
if
(
nextNode
)
{
if
(
nextNode
)
{
km
.
select
(
nextNode
);
km
.
select
(
nextNode
);
...
@@ -60,33 +60,36 @@ KityMinder.registerModule( "KeyboardModule", function () {
...
@@ -60,33 +60,36 @@ KityMinder.registerModule( "KeyboardModule", function () {
buildPositionNetwork
(
this
.
getRoot
()
);
buildPositionNetwork
(
this
.
getRoot
()
);
},
},
keydown
:
function
(
e
)
{
keydown
:
function
(
e
)
{
var
keys
=
KityMinder
.
keymap
;
switch
(
e
.
originEvent
.
keyCode
)
{
switch
(
e
.
originEvent
.
keyCode
)
{
case
key
map
.
Enter
:
case
key
s
.
Enter
:
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
)
);
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
)
);
e
.
preventDefault
();
e
.
preventDefault
();
break
;
break
;
case
key
map
.
Tab
:
case
key
s
.
Tab
:
this
.
execCommand
(
'appendChildNode'
,
new
MinderNode
(
'Topic'
)
);
this
.
execCommand
(
'appendChildNode'
,
new
MinderNode
(
'Topic'
)
);
e
.
preventDefault
();
e
.
preventDefault
();
break
;
break
;
case
key
map
.
Backspace
:
case
key
s
.
Backspace
:
case
key
map
.
Del
:
case
key
s
.
Del
:
this
.
execCommand
(
'removenode'
);
this
.
execCommand
(
'removenode'
);
e
.
preventDefault
();
e
.
preventDefault
();
break
;
break
;
case
keymap
.
Left
:
case
keys
.
Left
:
case
keymap
.
up
:
navigateTo
(
this
,
'left'
);
case
keymap
.
Right
:
e
.
preventDefault
();
case
keymap
.
Down
:
break
;
if
(
this
.
isSingleSelect
()
)
{
case
keys
.
Up
:
KBNavigate
(
this
,
{
navigateTo
(
this
,
'top'
);
37
:
'left'
,
e
.
preventDefault
();
38
:
'top'
,
break
;
39
:
'right'
,
case
keys
.
Right
:
40
:
'down'
navigateTo
(
this
,
'right'
);
}[
e
.
originEvent
.
keyCode
]
);
e
.
preventDefault
();
}
break
;
case
keys
.
Down
:
navigateTo
(
this
,
'down'
);
e
.
preventDefault
();
e
.
preventDefault
();
break
;
break
;
}
}
...
...
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