File tree 4 files changed +74
-23
lines changed
4 files changed +74
-23
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = function ( grunt ) {
2
+
3
+ // Project configuration.
4
+ grunt . initConfig ( {
5
+ pkg : grunt . file . readJSON ( 'package.json' ) ,
6
+
7
+ // Js Hint
8
+ jshint : {
9
+ options : {
10
+ reporter : require ( 'jshint-stylish' )
11
+ } ,
12
+ all : [ 'Gruntfile.js' , 'lib/**/*.js' , 'test/**/*.js' ]
13
+ } ,
14
+
15
+ // Jamsine
16
+ jasmine : {
17
+ emailBuilder : {
18
+ src : 'index.js' ,
19
+ options : {
20
+ specs : 'test/specs/*Spec.js' ,
21
+ helpers : 'test/spec/*Helper.js'
22
+ }
23
+ }
24
+ }
25
+ } ) ;
26
+
27
+ // Load tasks
28
+ grunt . loadNpmTasks ( 'grunt-contrib-jshint' ) ;
29
+ grunt . loadNpmTasks ( 'grunt-contrib-jasmine' ) ;
30
+
31
+ // Default task(s).
32
+ grunt . registerTask ( 'default' , [ 'jshint' ] ) ;
33
+ grunt . registerTask ( 'test' , [ 'jshint' , 'jasmine' ] ) ;
34
+
35
+ } ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ function EmailBuilder(task) {
24
24
this . task = task ;
25
25
this . options = task . options ( EmailBuilder . Defaults ) ;
26
26
this . basepath = process . cwd ( ) ;
27
+
27
28
}
28
29
29
30
EmailBuilder . taskName = 'emailBuilder' ;
@@ -88,7 +89,7 @@ EmailBuilder.prototype.handleConditionals = function(html){
88
89
89
90
EmailBuilder . prototype . prepareHtml = function ( file ) {
90
91
91
- var html = this . grunt . file . read ( file ) ,
92
+ var html = this . grunt . file . read ( file ) ,
92
93
$ = cheerio . load ( html ) ,
93
94
styleTags = $ ( 'style' ) ,
94
95
linkTags = $ ( 'link' ) ,
@@ -326,27 +327,9 @@ EmailBuilder.prototype.run = function() {
326
327
. then ( this . sendEmailTest ) ;
327
328
328
329
} )
329
- . catch ( function ( err ) { this . grunt . log . error ( err ) ; } ) ;
330
- } ;
331
-
332
-
333
- EmailBuilder . registerWithGrunt = function ( grunt ) {
334
-
335
- // Please see the grunt documentation for more information regarding task and
336
- // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md
337
-
338
- // ==========================================================================
339
- // TASKS
340
- // ==========================================================================
341
-
342
- grunt . registerMultiTask ( EmailBuilder . taskName , EmailBuilder . taskDescription , function ( ) {
343
-
344
- this . grunt = grunt ;
345
- var done = this . async ( ) ;
346
- var task = new EmailBuilder ( this ) ;
330
+ . catch ( function ( err ) {
347
331
348
- task . run ( )
349
- . done ( done ) ;
332
+ this . grunt . log . error ( err ) ;
350
333
351
334
} ) ;
352
335
} ;
Original file line number Diff line number Diff line change 4
4
"description" : " Email builder core" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "test" : " test"
7
+ "test" : " grunt test"
8
8
},
9
9
"repository" : {
10
10
"type" : " git" ,
22
22
"lodash" : " ^2.4.1"
23
23
},
24
24
"devDependencies" : {
25
- "grunt" : " ^0.4.5"
25
+ "grunt" : " ^0.4.5" ,
26
+ "grunt-contrib-jasmine" : " ^0.8.1" ,
27
+ "grunt-contrib-jshint" : " ^0.10.0" ,
28
+ "jshint-stylish" : " ^1.0.0"
26
29
}
27
30
}
Original file line number Diff line number Diff line change
1
+ describe ( "Calendar Stuff" , function ( ) {
2
+ var emailBuilder ;
3
+
4
+ beforeEach ( function ( ) {
5
+ emailBuilder = new EmailBuilder ( ) ;
6
+ } ) ;
7
+
8
+ describe ( 'Something something' , function ( ) {
9
+ var today ;
10
+
11
+ beforeEach ( function ( ) {
12
+ today = new Date ( ) ;
13
+ } ) ;
14
+
15
+ it ( 'should be main entry' , function ( ) {
16
+ var expected = '<strong>10:00</strong> AM' ;
17
+ var unit = 'hours' ;
18
+ var minutesFrom = 60 ;
19
+
20
+ today . setHours ( 10 , 0 , 0 , 0 ) ;
21
+ var dateString = calendar . constructTimeEntry ( today , minutesFrom , unit ) ;
22
+
23
+ expect ( dateString . date ) . toBe ( '<strong>10:00</strong> AM' ) ;
24
+ } ) ;
25
+
26
+
27
+ } ) ;
28
+
29
+
30
+ } ) ;
You can’t perform that action at this time.
0 commit comments