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
de30dda3
Commit
de30dda3
authored
Sep 01, 2014
by
worry127722
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kity
parent
84b36511
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
371 additions
and
8 deletions
+371
-8
command.js
spec/core/command.js
+26
-0
utils.js
spec/core/utils.js
+173
-0
import.js
spec/import.js
+85
-1
karma.conf.js
spec/karma.conf.js
+53
-2
caseSource.php
spec/tools/caseSource.php
+25
-1
test.css
spec/tools/css/test.css
+1
-1
import.php
spec/tools/import.php
+3
-3
run.php
spec/tools/run.php
+5
-0
No files found.
spec/core/command.js
View file @
de30dda3
describe
(
"command"
,
function
()
{
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
kityMinderDiv
.
style
.
position
=
"relative"
;
var
obj
;
var
km
;
beforeEach
(
function
(){
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
getKityMinder
(
'kityminder'
);
obj
=
document
.
getElementById
(
'kityminder'
);
kityMinderDiv
.
style
.
display
=
"block"
;
});
afterEach
(
function
(){
obj
=
null
;
kityMinderDiv
.
style
.
display
=
"none"
;
document
.
body
.
removeChild
(
kityMinderDiv
);
});
it
(
''
,
function
(){
console
.
log
(
obj
);
})
});
\ No newline at end of file
spec/core/utils.js
View file @
de30dda3
describe
(
"utils"
,
function
()
{
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
kityMinderDiv
.
style
.
position
=
"relative"
;
var
obj
;
var
km
;
var
flag
=
true
;
beforeEach
(
function
(){
if
(
flag
){
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
getKityMinder
(
'kityminder'
);
obj
=
document
.
getElementById
(
'kityminder'
);
flag
=
false
;
}
});
afterEach
(
function
(){
// obj = null;
// km = null;
// KM = null;
// kityMinderDiv.style.display = "none";
// document.body.removeChild(kityMinderDiv);
console
.
log
(
document
.
body
);
});
describe
(
'compareObject'
,
function
(){
...
...
@@ -22,4 +52,147 @@ describe("utils", function () {
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
});
\ No newline at end of file
spec/import.js
View file @
de30dda3
...
...
@@ -8,9 +8,93 @@
///import core/module;
///import core/event;
///import core/minder;
///import core/minder.data.compatibility;
///import core/minder.data;
///import core/minder.event;
///import core/minder.module;
///import core/minder.command;
///import core/minder.node;
///import core/minder.select;
\ No newline at end of file
///import core/minder.select;
///import core/keymap;
///import core/minder.lang;
///import core/minder.defaultoptions;
///import core/minder.preference;
///import core/browser;
///import core/layout;
///import core/connect;
///import core/render;
///import core/theme;
///import core/template;
///import layout/default;
///import layout/default.connect;
///import layout/bottom;
///import layout/filetree;
///import theme/default;
///import theme/snow;
///import theme/fresh;
///import template/structure;
///import module/node;
///import module/text;
///import module/expand;
///import module/outline;
///import module/geometry;
///import module/history;
///import module/progress;
///import module/priority;
///import module/image;
///import module/resource;
///import module/view;
///import module/dragtree;
///import module/dropfile;
///import module/keyboard;
///import module/select;
///import module/history;
///import module/editor;
///import module/editor.range;
///import module/editor.receiver;
///import module/editor.selection;
///import module/basestyle;
///import module/font;
///import module/zoom;
///import module/hyperlink;
///import module/arrange;
///import module/paste;
///import ui/jquery-ui-1.10.4.custom.min;
///import ui/widget;
///import ui/button;
///import ui/toolbar;
///import ui/menu;
///import ui/dropmenu;
///import ui/splitbutton;
///import ui/colorsplitbutton;
///import ui/popup;
///import ui/scale;
///import ui/colorpicker;
///import ui/combobox;
///import ui/buttoncombobox;
///import ui/modal;
///import ui/tooltip;
///import ui/tab;
///import ui/separator;
///import ui/scale;
///import adapter/utils;
///import adapter/adapter;
///import adapter/button;
///import adapter/combobox;
///import adapter/color;
///import adapter/saveto;
///import adapter/tooltips;
///import adapter/face;
///import adapter/node;
///import adapter/contextmenu;
///import adapter/dialog;
///import adapter/hyperlink;
///import adapter/image;
///import adapter/zoom;
///import protocal/xmind;
///import protocal/freemind;
///import protocal/mindmanager;
///import protocal/plain;
///import protocal/json;
///import protocal/png;
///import protocal/svg;
\ No newline at end of file
spec/karma.conf.js
View file @
de30dda3
...
...
@@ -17,9 +17,16 @@ module.exports = function(config) {
files
:
[
base_path
+
'spec/tools/js/UserAction.js'
,
base_path
+
'spec/SpecHelper.js'
,
base_path
+
'kity/dist/kity
graph.all
.js'
,
base_path
+
'kity/dist/kity.js'
,
base_path
+
'lib/jquery-2.1.0.min.js'
,
base_path
+
'lib/jquery.xml2json.js'
,
base_path
+
'lib/ZeroClipboard.min.js'
,
base_path
+
'kityminder.config.js'
,
base_path
+
'lang/zh-cn/zh-cn.js'
,
base_path
+
'lib/zip.js'
,
base_path
+
'lib/baidu-frontia-js-full-1.0.0.js'
,
base_path
+
'social/draftmanager.js'
,
base_path
+
'social/social.js'
,
base_path
+
'src/core/kityminder.js'
,
base_path
+
'src/core/utils.js'
...
...
@@ -36,6 +43,15 @@ module.exports = function(config) {
,
base_path
+
'src/core/keymap.js'
,
base_path
+
'src/core/minder.lang.js'
,
base_path
+
'src/core/minder.defaultoptions.js'
,
base_path
+
'src/core/browser.js'
,
base_path
+
'src/core/connect.js'
,
base_path
+
'src/core/layout.js'
,
base_path
+
'src/core/minder.data.compatibility.js'
,
base_path
+
'src/core/minder.preference.js'
,
base_path
+
'src/core/render.js'
,
base_path
+
'src/core/template.js'
,
base_path
+
'src/core/theme.js'
,
base_path
+
'src/module/geometry.js'
,
base_path
+
'src/module/history.js'
,
base_path
+
'src/module/icon.js'
...
...
@@ -56,6 +72,18 @@ module.exports = function(config) {
,
base_path
+
'src/module/basestyle.js'
,
base_path
+
'src/module/font.js'
,
base_path
+
'src/module/zoom.js'
,
base_path
+
'src/module/arrange.js'
,
base_path
+
'src/module/expand.js'
,
base_path
+
'src/module/hyperlink.js'
,
base_path
+
'src/module/image.js'
,
base_path
+
'src/module/node.js'
,
base_path
+
'src/module/outline.js'
,
base_path
+
'src/module/paste.js'
,
base_path
+
'src/module/priority.js'
,
base_path
+
'src/module/progress.js'
,
base_path
+
'src/module/resource.js'
,
base_path
+
'src/module/text.js'
,
base_path
+
'src/ui/jquery-ui-1.10.4.custom.min.js'
,
base_path
+
'src/ui/widget.js'
,
base_path
+
'src/ui/button.js'
...
...
@@ -74,6 +102,7 @@ module.exports = function(config) {
,
base_path
+
'src/ui/tab.js'
,
base_path
+
'src/ui/separator.js'
,
base_path
+
'src/ui/scale.js'
,
base_path
+
'src/adapter/utils.js'
,
base_path
+
'src/adapter/adapter.js'
,
base_path
+
'src/adapter/button.js'
...
...
@@ -85,6 +114,12 @@ module.exports = function(config) {
,
base_path
+
'src/adapter/node.js'
,
base_path
+
'src/adapter/contextmenu.js'
,
base_path
+
'src/adapter/dialog.js'
,
base_path
+
'src/adapter/color.js'
,
base_path
+
'src/adapter/face.js'
,
base_path
+
'src/adapter/hyperlink.js'
,
base_path
+
'src/adapter/image.js'
,
base_path
+
'src/adapter/zoom.js'
,
base_path
+
'src/protocal/xmind.js'
,
base_path
+
'src/protocal/freemind.js'
,
base_path
+
'src/protocal/mindmanager.js'
...
...
@@ -92,6 +127,19 @@ module.exports = function(config) {
,
base_path
+
'src/protocal/json.js'
,
base_path
+
'src/protocal/png.js'
,
base_path
+
'src/protocal/svg.js'
,
base_path
+
'src/layout/bottom.js'
,
base_path
+
'src/layout/default.connect.js'
,
base_path
+
'src/layout/default.js'
,
base_path
+
'src/layout/filetree.js'
,
base_path
+
'src/template/structure.js'
,
base_path
+
'src/theme/default.js'
,
base_path
+
'src/theme/fresh.js'
,
base_path
+
'src/theme/snow.js'
,
base_path
+
'spec/core/*.js'
,
base_path
+
'spec/module/*.js'
,
base_path
+
'spec/protocal/*.js'
...
...
@@ -152,7 +200,10 @@ module.exports = function(config) {
'../src/adapter/*.js'
:
[
'coverage'
],
'../src/module/*.js'
:
[
'coverage'
],
'../src/protocal/*.js'
:
[
'coverage'
],
'../src/ui/*.js'
:
[
'coverage'
]
'../src/ui/*.js'
:
[
'coverage'
],
'../src/layout/*.js'
:
[
'coverage'
],
'../src/template/*.js'
:
[
'coverage'
],
'../src/theme/*.js'
:
[
'coverage'
]
}
,
coverageReporter
:
{
...
...
spec/tools/caseSource.php
View file @
de30dda3
...
...
@@ -51,16 +51,40 @@ class Kiss
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$f
.
'"></script>'
.
"
\n
"
;
}
}
//先引用kity
print
"<script src='../../kity/dist/kitygraph.all.js'></script>
\n
"
;
print
"<script src='../../lib/jquery-2.1.0.min.js'></script>
\n
"
;
print
"<script src='../../lib/ZeroClipboard.min.js' charset='utf-8'></script>
\n
"
;
print
"<script type='text/javascript'>ZeroClipboard.setDefaults( { moviePath: '../../lib/ZeroClipboard.swf' } );</script>
\n
"
;
print
"<script src='../../kity/dist/kity.js' charset='utf-8'></script>
\n
"
;
//分成两部分:一部分默认加载(可配置),一部分针对文件加载(例如在文件头部有注释标注依赖文件,根据依赖文件动态加载)
// core里面的文件全部加载,module加载用例对应的src文件,最后加载与用例同名的原文件
$importurl
=
"
{
$this
->
testPath
}
tools/import.php?f=
$this->name
"
;
if
(
$cov
)
$importurl
.=
'^&cov=true'
;
print
"<script type='text/javascript' src='"
.
$importurl
.
"' ></script>
\n
"
;
print
"<script src='../../kityminder.config.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lang/zh-cn/zh-cn.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/zip.js' charset='utf-8'></script>
\n
"
;
print
"<script>zip.inflateJSPath = '../../lib/inflate.js';</script>
\n
"
;
print
"<script src='../../lib/jquery.xml2json.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/baidu-frontia-js-full-1.0.0.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../social/draftmanager.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../social/social.js' charset='utf-8'></script>
\n
"
;
//引用测试文件
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$this
->
name
.
'.js"></script>'
.
"
\n
"
;
print
"<link href='../../social/social.css' rel='stylesheet'>
\n
"
;
print
"<link href='../../themes/default/css/import.css' type='text/css' rel='stylesheet' />
\n
"
;
print
"<link href='../../favicon.ico' type='image/x-icon' rel='shortcut icon'>
\n
"
;
print
"<link href='../../favicon.ico' type='image/x-icon' rel='apple-touch-icon-precomposed'>
\n
"
;
}
public
function
match
(
$matcher
)
{
...
...
spec/tools/css/test.css
View file @
de30dda3
...
...
@@ -147,7 +147,7 @@ a.button:active span {
}
.runningarea
{
height
:
6
0%
;
height
:
10
0%
;
}
.runningmaindiv
{
...
...
spec/tools/import.php
View file @
de30dda3
...
...
@@ -39,7 +39,7 @@ function importSrc(){
$path
=
$i
.
'.js'
;
$srcFile
=
Config
::
$projroot
.
Config
::
$src_PATH
.
$path
;
if
(
file_exists
(
$srcFile
))
{
echo
"document.write('<script charset=utf-8 src=
\"
$srcFile
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
$srcFile
\"
></script>');
\n
"
;
}
}
if
(
file_exists
(
$this_src
)){
...
...
@@ -50,7 +50,7 @@ function importSrc(){
if
(
custom_strEmpty
(
$statment
)){
continue
;
}
else
if
(
preg_match
(
'/\/\/\/import\s+([^;]+);?/ies'
,
$statment
,
$r
)){
echo
"document.write('<script charset=utf-8 src=
\"
"
.
Config
::
$projroot
.
Config
::
$src_PATH
.
$r
[
1
]
.
".js
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
"
.
Config
::
$projroot
.
Config
::
$src_PATH
.
$r
[
1
]
.
".js
\"
></script>');
\n
"
;
}
else
{
break
;
}
...
...
@@ -59,7 +59,7 @@ function importSrc(){
}
//加载与用例同名的原文件,并避免重复加载
if
(
$flag_ownSrc
){
echo
"document.write('<script charset=utf-8 src=
\"
"
.
$this_src
.
"
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
"
.
$this_src
.
"
\"
></script>');
\n
"
;
}
}
importSrc
();
\ No newline at end of file
spec/tools/run.php
View file @
de30dda3
...
...
@@ -60,7 +60,12 @@ $cov = array_key_exists( 'cov' , $_GET );
};
function
execJasmine
()
{
// jasmineEnv.beforeEach(function(){console.log(12)});
// jasmine.Suite.beforeEach(function(){console.log(123)});
// console.log(jasmineEnv.currentSpec);
// jasmineEnv.currentSpec.start=function(){console.log(123)};
jasmineEnv
.
execute
();
}
})();
...
...
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