Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit b05155a

Browse files
committed
style: fix the grunt watch and make jshint happy
1 parent 9476690 commit b05155a

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

demo/demo.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
angular.module('doc.ui-ace', ['ui.ace', 'prettifyDirective', 'ui.bootstrap', 'plunker'])
24
.controller('AceCtrl', ['$scope', function ($scope) {
35

@@ -13,7 +15,7 @@ angular.module('doc.ui-ace', ['ui.ace', 'prettifyDirective', 'ui.bootstrap', 'pl
1315

1416
// HACK to have the ace instance in the scope...
1517
$scope.modeChanged = function () {
16-
_ace.getSession().setMode("ace/mode/" + $scope.mode.toLowerCase());
18+
_ace.getSession().setMode('ace/mode/' + $scope.mode.toLowerCase());
1719
};
1820

1921
}
@@ -28,4 +30,4 @@ angular.module('doc.ui-ace', ['ui.ace', 'prettifyDirective', 'ui.bootstrap', 'pl
2830
'function foo(msg) {\n\tvar r = Math.random();\n\treturn "" + r + " : " + msg;\n}';
2931

3032
}])
31-
;
33+
;

gruntFile.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = function (grunt) {
24

35
var _ = grunt.util._;
@@ -6,7 +8,7 @@ module.exports = function (grunt) {
68

79
// Default task.
810
grunt.registerTask('default', ['jshint', 'karma:unit']);
9-
grunt.registerTask('server', ['karma:start']);
11+
grunt.registerTask('serve', ['karma:continuous', 'watch']);
1012
grunt.registerTask('build-doc', ['uglify', 'copy']);
1113

1214
var testConfig = function (configFile, customOptions) {
@@ -35,26 +37,27 @@ module.exports = function (grunt) {
3537
' */',
3638
''].join('\n'),
3739
view : {
38-
humaName : "UI Ace",
39-
repoName : "ui-ace",
40-
demoHTML : grunt.file.read("demo/demo.html"),
41-
demoJS : grunt.file.read("demo/demo.js"),
40+
humaName : 'UI Ace',
41+
repoName : 'ui-ace',
42+
demoHTML : grunt.file.read('demo/demo.html'),
43+
demoJS : grunt.file.read('demo/demo.js'),
4244
css: ['assets/css/demo.css'],
4345
js: js_dependencies.concat(['build/ui-ace.min.js'])
4446
}
4547
},
4648
watch: {
4749
karma: {
48-
files: ['ui-ace.js', 'test/*.js'],
49-
tasks: ['karma:unit:run'] //NOTE the :run flag
50+
files: ['ui-ace.js', 'demo/**/*.js', 'gruntFile.js'],
51+
tasks: ['jshint', 'karma:unit:run'] //NOTE the :run flag
5052
}
5153
},
5254
karma: {
5355
unit: testConfig('test/karma.conf.js'),
54-
start: {configFile: 'test/karma.conf.js'}
56+
start: {configFile: 'test/karma.conf.js'},
57+
continuous: {configFile: 'test/karma.conf.js', background: true }
5558
},
5659
jshint:{
57-
files:['ui-ace.js', 'demo/**/*.js'],
60+
files:['ui-ace.js', 'demo/**/*.js', 'gruntFile.js'],
5861
options: { jshintrc: '.jshintrc' }
5962
},
6063
uglify: {

ui-ace.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
'use strict';
2+
13
/**
24
* Binds a ACE Ediitor widget
35
*/
4-
5-
//TODO handle Could not load worker ace.js:1
6-
//DOMException {message: "SECURITY_ERR: DOM Exception 18", name: "SECURITY_ERR", code: 18, stack: "Error: An attempt was made to break through the se…cloudfront.net/src-min-noconflict/ace.js:1:76296)", INDEX_SIZE_ERR: 1…}
7-
86
angular.module('ui.ace', [])
97
.constant('uiAceConfig', {})
108
.directive('uiAce', ['uiAceConfig', function (uiAceConfig) {
@@ -66,16 +64,16 @@ angular.module('ui.ace', [])
6664

6765
// Basic options
6866
if (angular.isString(opts.theme)) {
69-
acee.setTheme("ace/theme/" + opts.theme);
67+
acee.setTheme('ace/theme/' + opts.theme);
7068
}
7169
if (angular.isString(opts.mode)) {
72-
session.setMode("ace/mode/" + opts.mode);
70+
session.setMode('ace/mode/' + opts.mode);
7371
}
7472

7573
attrs.$observe('readonly', function (value) {
7674
acee.setReadOnly(value === 'true');
7775
});
78-
76+
7977
// Value Blind
8078
if (angular.isDefined(ngModel)) {
8179
ngModel.$formatters.push(function (value) {
@@ -98,4 +96,4 @@ angular.module('ui.ace', [])
9896

9997
}
10098
};
101-
}]);
99+
}]);

0 commit comments

Comments
 (0)