Skip to content

Commit 2b163ac

Browse files
committed
Merge pull request #4 from CrossLead/fixes_ng_module_error
Fixes error where app module fails to load in testing
2 parents eb143b7 + 8ae6684 commit 2b163ac

8 files changed

+62
-25
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
language: node_js
22
node_js: ["0.10"]
3+
before_install:
4+
- export CHROME_BIN=chromium-browser
5+
- export DISPLAY=:99.0
6+
- sh -e /etc/init.d/xvfb start
37
before_script:
48
- npm install -g bower gulp
59
- bower install

dist/angular-zendesk-widget.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
}
1111

1212
var window = $window;
13+
1314
// Following is essentially a copy paste of JS portion of the Zendesk embed code
1415
// with our settings subbed in. For more info, see:
1516
// https://support.zendesk.com/hc/en-us/articles/203908456-Using-Web-Widget-to-embed-customer-service-in-your-website
1617

17-
// Note that JSHint ignore is not working in latest release, so can't actually turn
18-
// on JSHint yet. See https://github.com/jshint/jshint/issues/2411
19-
/* jshint ignore:start */
18+
/*eslint-disable */
2019

2120
window.zEmbed || function(e, t) {
2221
var n, o, d, i, s, a = [],
@@ -35,7 +34,7 @@
3534
}, o.write('<body onload="document._l();">'), o.close()
3635
}("https://assets.zendesk.com/embeddable_framework/main.js", zendeskWidgetSettings.accountUrl);
3736

38-
/* jshint ignore:end */
37+
/*eslint-enable */
3938

4039
$window.zE(function() {
4140
zendeskWidgetSettings.beforePageLoad($window.zE);

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ gulp.task('lint', function () {
7272
module: true,
7373
require: true,
7474
__dirname: true,
75-
document: true
75+
document: true,
76+
process: true
7677
}
7778
}))
7879
// Outputs the results to the console

karma-dist-concatenated.conf.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ module.exports = function(config) {
1010

1111
// frameworks to use
1212
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13-
frameworks: ['mocha', 'chai-jquery', 'jquery-1.8.3', 'sinon-chai'],
13+
frameworks: ['jasmine'],
1414

1515
plugins: [
16-
'karma-mocha',
17-
'karma-chai',
16+
'karma-jasmine',
1817
'karma-sinon-chai',
1918
'karma-chrome-launcher',
20-
'karma-phantomjs-launcher',
21-
'karma-jquery',
22-
'karma-chai-jquery'
19+
'karma-spec-reporter'
2320
],
2421

2522
// list of files / patterns to load in the browser
@@ -67,11 +64,25 @@ module.exports = function(config) {
6764

6865
// start these browsers
6966
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
70-
browsers: ['PhantomJS'],
67+
browsers: ['Chrome'],
68+
69+
70+
// Use a custom launcher to run Chrome on TravisCI
71+
customLaunchers: {
72+
Chrome_travis_ci: {
73+
base: 'Chrome',
74+
flags: ['--no-sandbox']
75+
}
76+
},
7177

7278

7379
// Continuous Integration mode
7480
// if true, Karma captures browsers, runs the tests and exits
7581
singleRun: false
7682
});
83+
84+
// Switch browser to Chrome if TravisCI is detected
85+
if (process.env.TRAVIS) {
86+
config.browsers = ['Chrome_travis_ci'];
87+
}
7788
};

karma-dist-minified.conf.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ module.exports = function(config) {
1010

1111
// frameworks to use
1212
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13-
frameworks: ['mocha', 'chai-jquery', 'jquery-1.8.3', 'sinon-chai'],
13+
frameworks: ['jasmine'],
1414

1515
plugins: [
16-
'karma-mocha',
17-
'karma-chai',
16+
'karma-jasmine',
1817
'karma-sinon-chai',
1918
'karma-chrome-launcher',
20-
'karma-phantomjs-launcher',
21-
'karma-jquery',
22-
'karma-chai-jquery'
19+
'karma-spec-reporter'
2320
],
2421

2522
// list of files / patterns to load in the browser
@@ -67,11 +64,24 @@ module.exports = function(config) {
6764

6865
// start these browsers
6966
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
70-
browsers: ['PhantomJS'],
67+
browsers: ['Chrome'],
7168

7269

70+
// Use a custom launcher to run Chrome on TravisCI
71+
customLaunchers: {
72+
Chrome_travis_ci: {
73+
base: 'Chrome',
74+
flags: ['--no-sandbox']
75+
}
76+
},
77+
7378
// Continuous Integration mode
7479
// if true, Karma captures browsers, runs the tests and exits
7580
singleRun: false
7681
});
82+
83+
// Switch browser to Chrome if TravisCI is detected
84+
if (process.env.TRAVIS) {
85+
config.browsers = ['Chrome_travis_ci'];
86+
}
7787
};

karma-src.conf.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = function(config) {
1515
plugins: [
1616
'karma-jasmine',
1717
'karma-sinon-chai',
18-
'karma-phantomjs-launcher',
18+
'karma-chrome-launcher',
1919
'karma-spec-reporter'
2020
],
2121

@@ -65,11 +65,26 @@ module.exports = function(config) {
6565

6666
// start these browsers
6767
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
68-
browsers: ['PhantomJS'],
68+
browsers: ['Chrome'],
69+
70+
71+
// Use a custom launcher to run Chrome on TravisCI
72+
customLaunchers: {
73+
Chrome_travis_ci: {
74+
base: 'Chrome',
75+
flags: ['--no-sandbox']
76+
}
77+
},
6978

7079

7180
// Continuous Integration mode
7281
// if true, Karma captures browsers, runs the tests and exits
7382
singleRun: false
7483
});
84+
85+
// Switch browser to Chrome if TravisCI is detected
86+
if (process.env.TRAVIS) {
87+
config.browsers = ['Chrome_travis_ci'];
88+
}
7589
};
90+

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
"karma-chrome-launcher": "^0.1.4",
3030
"karma-jasmine": "^0.3.6",
3131
"karma-jquery": "^0.1.0",
32-
"karma-mocha": "^0.1.8",
33-
"karma-phantomjs-launcher": "^0.1.4",
3432
"karma-sinon-chai": "^0.2.0",
3533
"karma-spec-reporter": "^0.0.18",
36-
"mocha": "^1.21.4",
3734
"run-sequence": "^1.0.2",
3835
"sinon": "^1.10.3",
3936
"sinon-chai": "^2.5.0"

test/unit/angular-zendesk-widget/zendeskWidgetSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('Angular Zendesk Widget', function() {
88
module('zendeskWidget');
99
expect(function() {
1010
inject()
11-
}).toThrow();
11+
}).toThrowError('Missing accountUrl. Please set in app config via ZendeskWidgetProvider');
1212
});
1313

1414
});

0 commit comments

Comments
 (0)