Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ref #105 added jasmine(v2.3.4) for test cases #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var pkg = require('./package.json'),
views: ['src/views/*.html'],
dist: 'dist'
},
specs = 'spec/*_spec.js'
uncompressedJs = 'filter.js',
compressedJs = 'filter.min.js';

Expand Down Expand Up @@ -79,6 +80,7 @@ gulp.task('scripts', function() {
gulp.task('watch', function() {
gulp.watch(scripts, ['scripts']);
gulp.watch(paths.lib, ['scripts']);
gulp.watch(specs, browserSync.reload)
});

gulp.task('browser-sync', function() {
Expand All @@ -99,3 +101,20 @@ gulp.task('build', function(cb){
gulp.task('default', function(cb){
runSequence('clean', 'scripts', ['browser-sync', 'watch'])
});

gulp.task('spec', function() {
browserSync({
server: {
baseDir: './spec',
index: 'SpecRunner.html',
routes: {
'/spec/lib/jquery.js': './spec/lib/jquery.js',
'/dist/filter.js': './dist/filter.js'
}
}
});
});

gulp.task('test', function(cb){
runSequence('spec', 'watch')
});
Empty file added spec/.keep
Empty file.
55 changes: 55 additions & 0 deletions spec/SpecRunner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Filter JS Specs</title>

<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.3.4/jasmine_favicon.png">
<link rel="stylesheet" href="lib/jasmine-2.3.4/jasmine.css">

<script type="text/javascript" src="lib/jasmine-2.3.4/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.3.4/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.3.4/boot.js"></script>

<!-- include source files here... -->
<script type="text/javascript" src="lib/jquery.js"></script>
<script type="text/javascript" src="dist/filter.js"></script>

<script type="text/javascript" src="data/movies.js"></script>
<!-- include spec files here... -->
<script src="filterjs_spec.js"></script>
</head>

<body>
<div class="container" style="display: none;">
<div>
<input type="text" class="form-control" id="searchbox" placeholder="Search &hellip;" autocomplete="off">
</div>

<table class="movies" id="movies">
<thead>
<tr>
<th>Name</th>
<th>Director</th>
<th>Actors</th>
<th>Year</th>
</thead>
</table>

<div id="pagination" class="movies-pagination"></div>
<div>
Per Page: <span id="per_page"></span>
</div>

<script id="movie-template" type="text/html">
<tr>
<td><%= name %></td>
<td><%= director %></td>
<td><%= stars %></td>
<td><%= year %></td>
</div>
</tr>
</script>
</div>
</body>
</html>
Loading