Skip to content

Commit f1422fa

Browse files
author
Aditya Shedge
committed
Ref #105 Added jasmine and testcases
- testcases for initialization, callbacks, pagination - added gulp task for running testcases Ref #105 added jasmine(v2.3.4) for test cases -added test cases for Filter JS initialization -added test cases for Filter JS callbacks -added a gulp task for running test cases Ref #105 added test cases for Filter JS pagination
1 parent 63a4ad8 commit f1422fa

File tree

15 files changed

+14067
-0
lines changed

15 files changed

+14067
-0
lines changed

gulpfile.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var pkg = require('./package.json'),
2525
views: ['src/views/*.html'],
2626
dist: 'dist'
2727
},
28+
specs = 'spec/*_spec.js'
2829
uncompressedJs = 'filter.js',
2930
compressedJs = 'filter.min.js';
3031

@@ -79,6 +80,7 @@ gulp.task('scripts', function() {
7980
gulp.task('watch', function() {
8081
gulp.watch(scripts, ['scripts']);
8182
gulp.watch(paths.lib, ['scripts']);
83+
gulp.watch(specs, browserSync.reload)
8284
});
8385

8486
gulp.task('browser-sync', function() {
@@ -99,3 +101,20 @@ gulp.task('build', function(cb){
99101
gulp.task('default', function(cb){
100102
runSequence('clean', 'scripts', ['browser-sync', 'watch'])
101103
});
104+
105+
gulp.task('spec', function() {
106+
browserSync({
107+
server: {
108+
baseDir: './spec',
109+
index: 'SpecRunner.html',
110+
routes: {
111+
'/spec/lib/jquery.js': './spec/lib/jquery.js',
112+
'/dist/filter.js': './dist/filter.js'
113+
}
114+
}
115+
});
116+
});
117+
118+
gulp.task('test', function(cb){
119+
runSequence('spec', 'watch')
120+
});

spec/.keep

Whitespace-only changes.

spec/SpecRunner.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Filter JS Specs</title>
6+
7+
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.3.4/jasmine_favicon.png">
8+
<link rel="stylesheet" href="lib/jasmine-2.3.4/jasmine.css">
9+
10+
<script type="text/javascript" src="lib/jasmine-2.3.4/jasmine.js"></script>
11+
<script type="text/javascript" src="lib/jasmine-2.3.4/jasmine-html.js"></script>
12+
<script type="text/javascript" src="lib/jasmine-2.3.4/boot.js"></script>
13+
14+
<!-- include source files here... -->
15+
<script type="text/javascript" src="lib/jquery.js"></script>
16+
<script type="text/javascript" src="dist/filter.js"></script>
17+
18+
<script type="text/javascript" src="data/movies.js"></script>
19+
<!-- include spec files here... -->
20+
<script src="filterjs_spec.js"></script>
21+
</head>
22+
23+
<body>
24+
<div class="container" style="display: none;">
25+
<div>
26+
<input type="text" class="form-control" id="searchbox" placeholder="Search &hellip;" autocomplete="off">
27+
</div>
28+
29+
<table class="movies" id="movies">
30+
<thead>
31+
<tr>
32+
<th>Name</th>
33+
<th>Director</th>
34+
<th>Actors</th>
35+
<th>Year</th>
36+
</thead>
37+
</table>
38+
39+
<div id="pagination" class="movies-pagination"></div>
40+
<div>
41+
Per Page: <span id="per_page"></span>
42+
</div>
43+
44+
<script id="movie-template" type="text/html">
45+
<tr>
46+
<td><%= name %></td>
47+
<td><%= director %></td>
48+
<td><%= stars %></td>
49+
<td><%= year %></td>
50+
</div>
51+
</tr>
52+
</script>
53+
</div>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)