Skip to content

Commit 2ad92b8

Browse files
committed
made init tests for minified build
1 parent 28becf5 commit 2ad92b8

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

karma.conf.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module.exports = function(config) {
1818
{ pattern: 'test/*.spec.js', included: true, served: true, watched: true },
1919
{ pattern: 'test/fixtures/**/*.html', included: false, served: true, watched: true },
2020
{ pattern: 'misc/**/*.*', included: false, served: true, watched: false },
21-
{ pattern: 'dist/booking.js', included: false, served: true, watched: true },
22-
{ pattern: 'dist/booking.js.map', included: false, served: true, watched: false }
21+
{ pattern: 'dist/**/*', included: false, served: true, watched: true }
2322
],
2423

2524
// list of files to exclude

test/fixtures/minified.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8">
4+
<title>Booking.js main fixture</title>
5+
<style type="text/css">
6+
body { background-color: #E6E6E6; max-width: 700px; margin: 0 auto; }
7+
</style>
8+
</head>
9+
<body>
10+
11+
<script type="text/javascript" src="/base/dist/booking.min.js"></script>
12+
13+
<div id="bookingjs"></div>
14+
15+
</body>
16+
</html>

test/initialization.spec.js

+37-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var baseConfig = require('./utils/defaultConfig');
66
var mockAjax = require('./utils/mockAjax');
77

88
/**
9-
* Intilialize the library
9+
* Intilialize the library with plain build
1010
*/
1111
describe('Initialization regular', function() {
1212

@@ -47,4 +47,40 @@ describe('Initialization regular', function() {
4747

4848
});
4949

50+
});
51+
52+
/**
53+
* Intilialize the library with minified build
54+
*/
55+
describe('Initialization minified', function() {
56+
57+
beforeEach(function(){
58+
loadFixtures('minified.html');
59+
mockAjax();
60+
});
61+
62+
afterEach(function() {
63+
jasmine.Ajax.uninstall();
64+
});
65+
66+
it('should be able to load the fixture page', function() {
67+
68+
expect(window).toBeDefined();
69+
expect($).toBeDefined();
70+
expect($('#bookingjs')).toBeInDOM();
71+
72+
});
73+
74+
it('should be able init and display the widget with instance pattern', function() {
75+
76+
var widget = new TimekitBooking();
77+
widget.init(baseConfig);
78+
79+
expect(widget).toBeDefined();
80+
expect(widget.getConfig()).toBeDefined();
81+
82+
expect($('.bookingjs-calendar')).toBeInDOM();
83+
84+
});
85+
5086
});

0 commit comments

Comments
 (0)