Skip to content

Commit e42009a

Browse files
Merge pull request #59 from angular/master
Update upstream
2 parents ccf743d + 32b1a0c commit e42009a

File tree

8 files changed

+65
-10
lines changed

8 files changed

+65
-10
lines changed

Gruntfile.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ module.exports = function(grunt) {
162162

163163
clean: {
164164
build: ['build'],
165-
tmp: ['tmp']
165+
tmp: ['tmp'],
166+
deploy: ['uploadDocs', 'uploadCode']
166167
},
167168

168169
eslint: {
@@ -326,7 +327,7 @@ module.exports = function(grunt) {
326327
files: [
327328
// The source files are needed by the embedded examples in the docs app.
328329
{
329-
src: 'build/angular*.{js,js.map,min.js}',
330+
src: ['build/angular*.{js,js.map,min.js}', 'build/sitemap.xml'],
330331
dest: 'uploadDocs/',
331332
expand: true,
332333
flatten: true
@@ -363,10 +364,6 @@ module.exports = function(grunt) {
363364
},
364365

365366
shell: {
366-
// Travis expects the firebase.json in the repository root, but we have it in a sub-folder
367-
'symlink-firebase-docs': {
368-
command: 'ln -s ./scripts/docs.angularjs.org-firebase/firebase.json ./firebase.json'
369-
},
370367
'install-node-dependencies': {
371368
command: 'yarn'
372369
},
@@ -466,7 +463,7 @@ module.exports = function(grunt) {
466463
'package',
467464
'compress:deployFirebaseCode',
468465
'copy:deployFirebaseCode',
469-
'shell:symlink-firebase-docs',
466+
'firebaseDocsJsonForTravis',
470467
'copy:deployFirebaseDocs'
471468
]);
472469
grunt.registerTask('default', ['package']);

lib/grunt/plugins.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ module.exports = function(grunt) {
6262
grunt.registerTask('collect-errors', 'Combine stripped error files', function() {
6363
util.collectErrors();
6464
});
65+
66+
grunt.registerTask('firebaseDocsJsonForTravis', function() {
67+
util.firebaseDocsJsonForTravis();
68+
});
69+
6570
};

lib/grunt/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,16 @@ module.exports = {
292292
}
293293
next();
294294
};
295+
},
296+
297+
// Our Firebase projects are in subfolders, but Travis expects them in the root,
298+
// so we need to modify the upload folder path and copy the file into the root
299+
firebaseDocsJsonForTravis: function() {
300+
var fileName = 'scripts/docs.angularjs.org-firebase/firebase.json';
301+
var json = grunt.file.readJSON(fileName);
302+
303+
json.hosting.public = 'uploadDocs';
304+
305+
grunt.file.write('firebase.json', JSON.stringify(json));
295306
}
296307
};

scripts/code.angularjs.org-firebase/functions/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const path = require('path');
66

77
const gcsBucketId = `${process.env.GCLOUD_PROJECT}.appspot.com`;
88

9-
const BROWSER_CACHE_DURATION = 300;
10-
const CDN_CACHE_DURATION = 600;
9+
const BROWSER_CACHE_DURATION = 60 * 10;
10+
const CDN_CACHE_DURATION = 60 * 60 * 12;
1111

1212
function sendStoredFile(request, response) {
1313
let filePathSegments = request.path.split('/').filter((segment) => {

scripts/docs.angularjs.org-firebase/firebase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"destination": "/index-production.html"
2424
},
2525
{
26-
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.map|.json|.css|.svg|.ttf|.txt|.woff|.woff2|.eot)",
26+
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.map|.json|.css|.svg|.ttf|.txt|.woff|.woff2|.eot|.xml)",
2727
"destination": "/index-production.html"
2828
}
2929
]

src/ng/directive/input.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,16 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
12481248
composing = true;
12491249
});
12501250

1251+
// Support: IE9+
1252+
element.on('compositionupdate', function(ev) {
1253+
// End composition when ev.data is empty string on 'compositionupdate' event.
1254+
// When the input de-focusses (e.g. by clicking away), IE triggers 'compositionupdate'
1255+
// instead of 'compositionend'.
1256+
if (isUndefined(ev.data) || ev.data === '') {
1257+
composing = false;
1258+
}
1259+
});
1260+
12511261
element.on('compositionend', function() {
12521262
composing = false;
12531263
listener();

src/ngMock/browserTrigger.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,24 @@
132132
evnt.keyCode = eventData.keyCode;
133133
evnt.charCode = eventData.charCode;
134134
evnt.which = eventData.which;
135+
} else if (/composition/.test(eventType)) {
136+
try {
137+
evnt = new window.CompositionEvent(eventType, {
138+
data: eventData.data
139+
});
140+
} catch (e) {
141+
// Support: IE9+
142+
evnt = window.document.createEvent('CompositionEvent', {});
143+
evnt.initCompositionEvent(
144+
eventType,
145+
eventData.bubbles,
146+
eventData.cancelable,
147+
window,
148+
eventData.data,
149+
null
150+
);
151+
}
152+
135153
} else {
136154
evnt = window.document.createEvent('MouseEvents');
137155
x = x || 0;

test/ng/directive/inputSpec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ describe('input', function() {
134134
browserTrigger(inputElm, 'compositionend');
135135
expect($rootScope.name).toEqual('caitp');
136136
});
137+
138+
139+
it('should end composition on "compositionupdate" when event.data is ""', function() {
140+
// This tests a bug workaround for IE9-11
141+
// During composition, when an input is de-focussed by clicking away from it,
142+
// the compositionupdate event is called with '', followed by a change event.
143+
var inputElm = helper.compileInput('<input type="text" ng-model="name" name="alias" />');
144+
browserTrigger(inputElm, 'compositionstart');
145+
helper.changeInputValueTo('caitp');
146+
expect($rootScope.name).toBeUndefined();
147+
browserTrigger(inputElm, 'compositionupdate', {data: ''});
148+
browserTrigger(inputElm, 'change');
149+
expect($rootScope.name).toEqual('caitp');
150+
});
137151
});
138152

139153

0 commit comments

Comments
 (0)