Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
1f7e4211
Commit
1f7e4211
authored
Dec 09, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test coverage fixes
parent
5884f1b9
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
244 additions
and
72 deletions
+244
-72
auth_test.js
app/components/auth/auth_test.js
+69
-31
crud_controller.js
app/components/crud/crud_controller.js
+3
-0
crud_controller_test.js
app/components/crud/crud_controller_test.js
+64
-4
dashboard_test.js
app/components/dashboard/dashboard_test.js
+26
-13
index.html
app/index.html
+1
-1
main.html
app/main.html
+1
-1
form_service.js
app/zetalib/form_service.js
+1
-2
form_service_test.js
app/zetalib/form_service_test.js
+8
-15
app.js
dist/app.js
+3
-3
components.js
dist/bower_components/components.js
+1
-1
docs_conf.js
docs/docs_conf.js
+46
-0
docs-template.html
docs/templates/docs-template.html
+20
-0
karma.conf.js
karma.conf.js
+1
-1
No files found.
app/components/auth/auth_test.js
View file @
1f7e4211
...
...
@@ -20,39 +20,73 @@ describe('ulakbus.auth module', function () {
expect
(
'ulakbus.auth.LoginCtrl'
).
toBeDefined
();
}));
var
$controller
;
var
$rootScope
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
$controller
=
_$controller_
;
}));
beforeEach
(
inject
(
function
(
$injector
)
{
$httpBackend
=
$injector
.
get
(
'$httpBackend'
);
$rootScope
=
$injector
.
get
(
'$rootScope'
);
}));
it
(
'should get login form'
,
inject
(
function
(
$rootScope
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'login'
,
{
cmd
:
''
})
.
respond
(
200
,
{});
var
$scope
=
$rootScope
.
$new
();
$scope
[
'url'
]
=
'login'
;
$scope
[
'form_params'
]
=
{
clear_wf
:
1
};
var
controller
=
$controller
(
'LoginCtrl'
,
{
$scope
:
$scope
});
expect
(
$scope
.
onSubmit
).
toBeDefined
();
//expect($scope.loginForm).toBeDefined();
//
//$scope.onSubmit($scope.loginForm);
})
);
it
(
'should validate email'
,
inject
([
'LoginService'
,
function
(
LoginService
)
{
expect
(
LoginService
.
isValidEmail
).
not
.
toBe
(
null
);
// test cases - testing for success
var
validEmails
=
[
'test@test.com'
,
'test@test.co.uk'
,
'test734ltylytkliytkryety9ef@jb-fe.com'
];
// test cases - testing for failure
var
invalidEmails
=
[
'test@testcom'
,
'test@ test.co.uk'
,
'ghgf@fe.com.co.'
,
'tes@t@test.com'
,
''
];
// you can loop through arrays of test cases like this
for
(
var
i
in
validEmails
)
{
var
valid
=
LoginService
.
isValidEmail
(
validEmails
[
i
]);
expect
(
valid
).
toBeTruthy
();
}
for
(
var
i
in
invalidEmails
)
{
var
valid
=
LoginService
.
isValidEmail
(
invalidEmails
[
i
]);
expect
(
valid
).
toBeFalsy
();
}
}])
function
(
LoginService
)
{
expect
(
LoginService
.
isValidEmail
).
not
.
toBe
(
null
);
// test cases - testing for success
var
validEmails
=
[
'test@test.com'
,
'test@test.co.uk'
,
'test734ltylytkliytkryety9ef@jb-fe.com'
];
// test cases - testing for failure
var
invalidEmails
=
[
'test@testcom'
,
'test@ test.co.uk'
,
'ghgf@fe.com.co.'
,
'tes@t@test.com'
,
''
];
// you can loop through arrays of test cases like this
for
(
var
i
in
validEmails
)
{
var
valid
=
LoginService
.
isValidEmail
(
validEmails
[
i
]);
expect
(
valid
).
toBeTruthy
();
}
for
(
var
i
in
invalidEmails
)
{
var
valid
=
LoginService
.
isValidEmail
(
invalidEmails
[
i
]);
expect
(
valid
).
toBeFalsy
();
}
}])
);
it
(
'should submit form'
,
inject
(
function
(
$httpBackend
,
RESTURL
)
{
}));
it
(
'ensures user can log in'
,
function
(
LoginService
,
$httpBackend
,
RESTURL
)
{
// todo: after backend api ready implement this
});
...
...
@@ -62,7 +96,11 @@ describe('ulakbus.auth module', function () {
// use httpBackend to imitate login api
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'login'
,
{
email
:
'test@test.com'
,
password
:
'password'
,
cmd
:
'do'
})
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'login'
,
{
email
:
'test@test.com'
,
password
:
'password'
,
cmd
:
'do'
})
// todo: with real api change response data from list to obj
.
respond
(
200
,
[{
'id'
:
1
,
'user'
:
{
...
...
app/components/crud/crud_controller.js
View file @
1f7e4211
...
...
@@ -9,6 +9,9 @@
'use strict'
;
angular
.
module
(
'ulakbus.crud'
,
[
'ui.bootstrap'
,
'schemaForm'
,
'formService'
])
.
config
(
function
(
sfErrorMessageProvider
)
{
sfErrorMessageProvider
.
setDefaultMessage
(
302
,
'Bu alan zorunludur.'
)
})
/**
* @name CrudUtility
...
...
app/components/crud/crud_controller_test.js
View file @
1f7e4211
...
...
@@ -6,24 +6,84 @@
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
describe
(
'crud controller module'
,
function
()
{
beforeEach
(
module
(
'ulakbus'
));
beforeEach
(
module
(
'ulakbus.crud'
));
beforeEach
(
inject
(
function
(
$injector
)
{
$httpBackend
=
$injector
.
get
(
'$httpBackend'
);
authRequestHandler
=
$httpBackend
.
when
(
'GET'
,
/
\.[
0-9a-z
]
+$/i
)
.
respond
({
userId
:
'userX'
},
{
'A-Token'
:
'xxx'
});
}));
var
$controller
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
beforeEach
(
inject
(
function
(
_$compile_
,
_$controller_
)
{
$compile
=
_$compile_
;
$controller
=
_$controller_
;
}));
describe
(
'crud controller'
,
function
()
{
it
(
'should have CRUDListFormCtrl'
,
inject
(
function
(
$controller
)
{
it
(
'should have CRUDListFormCtrl'
,
inject
(
function
()
{
expect
(
'ulakbus.crud.CRUDListFormCtrl'
).
toBeDefined
();
}));
it
(
'should have CRUDCtrl'
,
inject
(
function
()
{
expect
(
'ulakbus.crud.CRUDCtrl'
).
toBeDefined
();
}));
it
(
'should generate params'
,
inject
([
'CrudUtility'
,
function
(
CrudUtility
)
{
CrudUtility
.
generateParam
({},
{
'test_id'
:
'test'
},
'form'
);
CrudUtility
.
listPageItems
({
'objects'
:
[[],
{
'actions'
:
[{
'show_as'
:
'link'
,
'fields'
:
[
0
,
1
]}]
}]},
{
'test_id'
:
'test'
});
expect
(
$controller
).
toBeDefined
();
}]));
it
(
'should execute CRUDListFormCtrl with form cms'
,
inject
(
function
(
$rootScope
,
RESTURL
)
{
$httpBackend
.
expectGET
(
RESTURL
.
url
+
'ara/personel/123'
)
.
respond
(
200
,
{});
var
$scope
=
$rootScope
.
$new
();
var
$routeParams
=
{
cmd
:
'form'
};
var
controller
=
$controller
(
'CRUDListFormCtrl'
,
{
$scope
:
$scope
,
$routeParams
:
$routeParams
});
}));
it
(
'should execute CRUDListFormCtrl with list cmd'
,
inject
(
function
(
$rootScope
,
RESTURL
)
{
$httpBackend
.
expectGET
(
RESTURL
.
url
+
'ara/personel/123'
)
.
respond
(
200
,
{});
var
$scope
=
$rootScope
.
$new
();
var
$routeParams
=
{
cmd
:
'list'
};
var
controller
=
$controller
(
'CRUDListFormCtrl'
,
{
$scope
:
$scope
,
$routeParams
:
$routeParams
});
}));
it
(
'should execute CRUDListFormCtrl with relad cmd'
,
inject
(
function
(
$rootScope
,
RESTURL
)
{
$httpBackend
.
expectGET
(
RESTURL
.
url
+
'ara/personel/123'
)
.
respond
(
200
,
{});
var
$scope
=
$rootScope
.
$new
();
$scope
.
form_params
=
{};
$scope
.
reload_cmd
=
'list'
;
var
$routeParams
=
{
cmd
:
'reload'
};
var
controller
=
$controller
(
'CRUDListFormCtrl'
,
{
$scope
:
$scope
,
$routeParams
:
$routeParams
});
}));
it
(
'generates crud-filters directive'
,
inject
(
function
(
$rootScope
)
{
// Compile a piece of HTML containing the directive
var
$scope
=
$rootScope
.
$new
();
$scope
.
form_params
=
{
filters
:
[]};
var
element
=
$compile
(
"<crud-filters></crud-filters>"
)(
$scope
);
$scope
.
$digest
();
expect
(
element
.
html
()).
toContain
(
""
);
}));
});
});
\ No newline at end of file
app/components/dashboard/dashboard_test.js
View file @
1f7e4211
...
...
@@ -14,27 +14,40 @@ describe('dashboard controller module', function () {
beforeEach
(
module
(
'ulakbus.dashboard'
));
var
$controller
;
var
$rootScope
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
$controller
=
_$controller_
;
}));
var
$rootScope
;
beforeEach
(
inject
(
function
(
_$rootScope_
)
{
$rootScope
=
_$rootScope_
;
}));
beforeEach
(
inject
(
function
(
$injector
)
{
$httpBackend
=
$injector
.
get
(
'$httpBackend'
);
$rootScope
=
$injector
.
get
(
'$rootScope'
)
;
}));
describe
(
'dashboard controller'
,
function
()
{
it
(
'should define DashCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
it
(
'should define DashCtrl'
,
inject
(
function
()
{
expect
(
'ulakbus.dashboard.DashCtrl'
).
toBeDefined
();
}));
//it('should define section', function() {
// var $scope = {};
// var controller = $controller('DashCtrl', { $scope: $scope });
// $scope.section('test_section');
// expect($rootScope.section).toBe('test_section');
//});
it
(
'should execute DashCtrl functions'
,
inject
(
function
(
$rootScope
,
RESTURL
)
{
$httpBackend
.
expectGET
(
RESTURL
.
url
+
'ara/personel/123'
)
.
respond
(
200
,
{});
var
$scope
=
$rootScope
.
$new
();
var
controller
=
$controller
(
'DashCtrl'
,
{
$scope
:
$scope
});
$scope
.
student_kw
=
"123"
;
$scope
.
staff_kw
=
"123"
;
$scope
.
section
(
1
);
$scope
.
$broadcast
(
'authz'
,
{});
$scope
.
search
(
'personel'
);
$scope
.
search
(
'ogrenci'
);
$scope
.
getItems
(
'personel'
,
'123'
);
$scope
.
select
([
'test name'
,
'12345678'
,
'y37wgycuir7'
]);
$scope
.
$broadcast
(
'notifications'
,
{});
$scope
.
markAsRead
([
'123'
]);
}));
});
});
\ No newline at end of file
app/index.html
View file @
1f7e4211
...
...
@@ -69,7 +69,7 @@
<alert-box></alert-box>
<script
src=
"bower_components/angular/angular.
min.
js"
></script>
<script
src=
"bower_components/angular/angular.js"
></script>
<script
src=
"bower_components/angular-i18n/angular-locale_tr.js"
></script>
<script
src=
"bower_components/jquery/dist/jquery.min.js"
></script>
<script
src=
"bower_components/bootstrap/dist/js/bootstrap.min.js"
></script>
...
...
app/main.html
View file @
1f7e4211
...
...
@@ -77,7 +77,7 @@
<alert-box></alert-box>
<!-- @if NODE_ENV == 'DEVELOPMENT' -->
<script
src=
"bower_components/angular/angular.
min.
js"
></script>
<script
src=
"bower_components/angular/angular.js"
></script>
<script
src=
"bower_components/angular-i18n/angular-locale_tr.js"
></script>
<script
src=
"bower_components/jquery/dist/jquery.min.js"
></script>
<script
src=
"bower_components/bootstrap/dist/js/bootstrap.min.js"
></script>
...
...
app/zetalib/form_service.js
View file @
1f7e4211
...
...
@@ -558,8 +558,7 @@ angular.module('formService', ['ui.bootstrap'])
return
re
.
test
(
tcno
);
};
generator
.
isValidDate
=
function
(
dateValue
)
{
var
datevalid
=
Date
.
parse
(
dateValue
)
===
NaN
?
false
:
true
;
return
datevalid
;
return
!
isNaN
(
Date
.
parse
(
dateValue
));
};
generator
.
asyncValidators
=
{
emailNotValid
:
function
(
value
)
{
...
...
app/zetalib/form_service_test.js
View file @
1f7e4211
...
...
@@ -27,7 +27,7 @@ describe('form service module', function () {
function
(
Generator
)
{
expect
(
Generator
.
group
).
not
.
toBe
(
null
);
var
generated_url
=
Generator
.
makeUrl
({
url
:
'test'
,
form_params
:
{}});
expect
(
generated_url
).
toEqual
(
"//api.ulakbus.net/test
/
"
);
expect
(
generated_url
).
toEqual
(
"//api.ulakbus.net/test"
);
}])
);
...
...
@@ -97,7 +97,7 @@ describe('form service module', function () {
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
model
:
{
email
:
'test@test.com'
,
id
:
2
,
name
:
't
ravolta
'
,
email
:
'test@test.com'
,
id
:
2
,
name
:
't
est
'
,
save
:
{
title
:
'save'
,
type
:
'submit'
},
select
:
2
,
date
:
'12.12.2012'
,
...
...
@@ -125,7 +125,7 @@ describe('form service module', function () {
var
form_generated
=
Generator
.
prepareFormItems
(
scope
);
expect
(
form_generated
).
toEqual
(
form_json
);
expect
(
form_generated
.
form
).
toBeDefined
(
);
}])
);
...
...
@@ -133,7 +133,7 @@ describe('form service module', function () {
function
(
Generator
)
{
expect
(
Generator
.
dateformatter
).
not
.
toBe
(
null
);
var
generated_date
=
Generator
.
dateformatter
(
'2001-01-01T01:00:00Z'
);
expect
(
generated_date
).
toEqual
(
'1.1.2001'
);
expect
(
generated_date
).
toEqual
(
'
0
1.1.2001'
);
}])
);
...
...
@@ -154,7 +154,7 @@ describe('form service module', function () {
it
(
'should get form'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'add_student
/
'
,
{
cmd
:
'add'
})
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'add_student'
,
{
cmd
:
'add'
})
.
respond
(
200
,
{
forms
:
{
schema
:
{
...
...
@@ -192,7 +192,7 @@ describe('form service module', function () {
it
(
'should get list'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test
/personel
'
,
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test'
,
{
cmd
:
'list'
,
model
:
"personel"
,
object_id
:
"5821bc25a90aa1"
...
...
@@ -222,7 +222,7 @@ describe('form service module', function () {
it
(
'should submit form'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'student/add
/testmodel
'
)
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'student/add'
)
.
respond
(
200
,
{
data
:
'OK'
});
var
scope
=
{
...
...
@@ -298,12 +298,10 @@ describe('form service module', function () {
it
(
'should validate date'
,
inject
(
function
(
Generator
)
{
var
validDates
=
[
'12.12.2012'
,
'12/12/2012'
];
var
invalidDates
=
[
'00000000000'
,
'dsad'
,
'0.0.0'
,
'12.15.2012'
,
...
...
@@ -312,15 +310,10 @@ describe('form service module', function () {
for
(
var
i
in
validDates
)
{
var
valid
=
Generator
.
isValidDate
(
validDates
[
i
]);
console
.
log
(
validDates
[
i
]);
expect
(
valid
).
toBeTruthy
();
}
for
(
var
i
in
invalidDates
)
{
console
.
log
(
invalidDates
[
i
]);
var
valid
=
Generator
.
isValidDate
(
invalidDates
[
i
]);
console
.
log
(
valid
)
expect
(
valid
).
toBeFalsy
();
}
})
...
...
@@ -330,7 +323,7 @@ describe('form service module', function () {
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test
/testModel
?test=xyz123'
)
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test?test=xyz123'
)
.
respond
(
200
,
{
"client_cmd"
:
"form"
,
"object"
:
{
...
...
dist/app.js
View file @
1f7e4211
This diff is collapsed.
Click to expand it.
dist/bower_components/components.js
View file @
1f7e4211
This diff is collapsed.
Click to expand it.
docs/docs_conf.js
0 → 100644
View file @
1f7e4211
// Canonical path provides a consistent path (i.e. always forward slashes) across different OSes
var
path
=
require
(
'canonical-path'
);
var
Package
=
require
(
'dgeni'
).
Package
;
// Create and export a new Dgeni package called dgeni-example. This package depends upon
// the jsdoc and nunjucks packages defined in the dgeni-packages npm module.
module
.
exports
=
new
Package
(
'docs_conf'
,
[
require
(
'dgeni-packages/jsdoc'
),
require
(
'dgeni-packages/nunjucks'
)
])
// Configure our dgeni-example package. We can ask the Dgeni dependency injector
// to provide us with access to services and processors that we wish to configure
.
config
(
function
(
log
,
readFilesProcessor
,
templateFinder
,
writeFilesProcessor
)
{
// Set logging level
log
.
level
=
'info'
;
// Specify the base path used when resolving relative paths to source and output files
readFilesProcessor
.
basePath
=
path
.
resolve
(
__dirname
,
'..'
);
console
.
log
(
readFilesProcessor
.
basePath
);
// Specify collections of source files that should contain the documentation to extract
readFilesProcessor
.
sourceFiles
=
[
{
// Process all js files in `app` and its subfolders ...
include
:
'app/components/**/*.js'
,
// ... except for this one!
exclude
:
'app/**/*_test.js'
,
// When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath
:
'app'
}
];
// Add a folder to search for our own templates to use when rendering docs
templateFinder
.
templateFolders
.
unshift
(
path
.
resolve
(
__dirname
,
'templates'
));
// Specify how to match docs to templates.
// In this case we just use the same static template for all docs
templateFinder
.
templatePatterns
.
unshift
(
'docs-template.html'
);
// Specify where the writeFilesProcessor will write our generated doc files
writeFilesProcessor
.
outputFolder
=
'documentation'
;
});
\ No newline at end of file
docs/templates/docs-template.html
0 → 100644
View file @
1f7e4211
<h1>
{{ doc.codeName }} ({{ doc.outputPath }})
</h1>
<p>
{{ doc.description }}
</p>
{% if doc.params %}
<h2>
Params
</h2>
<ul>
{% for param in doc.params %}
<li>
<strong>
{{ param.name }}
</strong>
{ {{ param.typeList }} } - {{ param.description }}
</li>
{% endfor %}
</ul>
{% endif %}
{% if doc.returns %}
<h2>
Returns
</h2>
<p>
{ {{ doc.returns.typeList }} } - {{ doc.returns.description }}
</p>
{% endif %}
karma.conf.js
View file @
1f7e4211
...
...
@@ -72,7 +72,7 @@ module.exports = function (config) {
reporters
:
[
'progress'
,
'coverage'
],
preprocessors
:
{
'app/app.js'
:
[
'coverage'
],
//
'app/app.js': ['coverage'],
'app/components/auth/*.js'
:
[
'coverage'
],
'app/components/crud/*.js'
:
[
'coverage'
],
'app/components/dashboard/*.js'
:
[
'coverage'
],
...
...
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