Compare commits

...

12 Commits

Author SHA1 Message Date
Georgios Kalpakas 197e18d232 chore(protractor): update jasmine-reporters and switch to jasmine2 2016-12-08 14:17:26 +02:00
Peter Bacon Darwin 7d7b03811d chore(Gruntfile): lengthen a+ promise test timeout to prevent flakes 2016-12-07 23:48:02 +02:00
Martin Staffa bcac64b7b5 chore(travis): use Firefox 47
This commit also adds a new capability to the protractor configs that
ensures that all angularjs.org tests run correctly on Firefox. See
https://github.com/SeleniumHQ/selenium/issues/1202
2016-12-07 23:05:50 +02:00
Martin Staffa 8de31388da chore(npm): update protractor to 4.0.0
4.0.0 is the first version with Selenium 2.53.x, and we need that as lower versions have problems
with current Firefox versions.
See https://github.com/SeleniumHQ/selenium/issues/1202 and https://github.com/SeleniumHQ/selenium/issues/2110.

We are currently running tests on FF28.

As part of the update the deprecated webdriver fn getInnerHtml has been replaced with getAttribute('innerHTML')
2016-12-07 23:05:50 +02:00
Georgios Kalpakas 1d2f5e41b7 test(ngMocks): prevent Safari 10+ optimization that breaks test 2016-12-07 21:37:36 +02:00
Peter Bacon Darwin 6b3da2ddfe test($log): fix up to work with Safari 9
On Safari 9.0.2, you are not allowed to write to `sourceUrl` or `line`
on a native Error object.

This commit uses a custom error instead.
2016-12-07 15:20:25 +02:00
Peter Bacon Darwin d556519548 docs(CHANGELOG): add release notes for 1.2.32 and 1.4.14 2016-10-11 22:53:31 +01:00
Peter Bacon Darwin 6a7d715944 test(input-hidden): fix linting issue 2016-10-11 14:11:08 +01:00
Peter Bacon Darwin 35f3a4a0e3 fix($compile): ensure that hidden input values are correct after history.back
Due to the nature of some browser's PageCache/BFCache, returning to an Angular
app sometimes causes `input[hidden]` elements to retain the last value
that was stored before the page was navigated away from previously.

This is particularly problematic if the input has an interpolated value.
E.g. `<input type="hidden" value="{{ 1 + 2 }}">` since when the browser
returns, instead of the original interpolation template, the HTML contains
the previous value `<input type="hidden" value="3">`.

This commit instructs the browser not to attempt to reinstate the previous
value when navigating back in history by setting `autocomplete="off"` on
the hidden input element element.
2016-10-11 13:37:27 +01:00
Peter Bacon Darwin ff74511291 revert:fix(input): ensure that hidden input values are correct after history.back
This reverts commit 693d133456.
There was a regression against angular-material that relied upon the input directive
having `link.pre` property.
2016-10-11 13:36:33 +01:00
Peter Bacon Darwin cb04cfcab0 docs(CHANGELOG): add 1.4.13 release info 2016-10-10 22:53:38 +01:00
Peter Bacon Darwin 693d133456 fix(input): ensure that hidden input values are correct after history.back
Due to the nature of some browser's PageCache/BFCache, returning to an Angular
app sometimes causes `input[hidden]` elements to retain the last value
that was stored before the page was navigated away from previously.

This is particularly problematic if the input has an interpolated value.
E.g. `<input type="hidden" value="{{ 1 + 2 }}">` since when the browser
returns, instead of the original interpolation template, the HTML contains
the previous value `<input type="hidden" value="3">`.

This commit instructs the browser not to attempt to reinstate the previous
value when navigating back in history by setting `autocomplete="off"` on
the hidden input element element.
2016-10-10 22:02:52 +01:00
17 changed files with 10789 additions and 15679 deletions
+44
View File
@@ -1,3 +1,47 @@
<a name="1.4.14"></a>
# 1.4.14 material-distinction (2016-10-10)
This release reverts the fix in 1.4.13 and provides an alternative fix that doesn't break Angular Material.
## Reverts
- **input:** ensure that hidden input values are correct after history back
([ff7451129](https://github.com/angular/angular.js/commit/ff745112915ffa8249520218139b1a8021cd06d0))
## Bug Fixes
- **$compile:** ensure that hidden input values are correct after history back
([35f3a4a0e](https://github.com/angular/angular.js/commit/35f3a4a0e30fef0e019ca0ea2ae434428eaff83b))
<a name="1.2.32"></a>
# 1.2.32 alternation-intention (2016-10-10)
This release reverts the fix in 1.2.31 and provides an alternative fix that doesn't break Angular Material.
## Reverts
- **input:** ensure that hidden input values are correct after history back
([ed44dd065](https://github.com/angular/angular.js/commit/ed44dd0659f346ced78a112e4a2b30d3af4fd572))
## Bug Fixes
- **$compile:** ensure that hidden input values are correct after history back
([b8a0ecdd6](https://github.com/angular/angular.js/commit/b8a0ecdd6189fb111734eb5b6d4d473d0dcf4c36))
<a name="1.4.13"></a>
# 1.4.13 croaking-elderweed (2016-10-10)
## Bug Fixes
- **input:** ensure that hidden input values are correct after history back
([693d1334](https://github.com/angular/angular.js/commit/693d1334566f78987f5a361a100db4f889f35abd))
<a name="1.4.12"></a>
# 1.4.12
*Invalid release*
<a name="1.4.11"></a>
# 1.4.11 relentless-syncomania (2016-05-27)
+1 -1
View File
@@ -314,7 +314,7 @@ module.exports = function(grunt) {
stderr: true,
failOnError: true
},
command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js')
command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js --timeout 2000')
}
},
+1 -3
View File
@@ -6,8 +6,6 @@ config.specs = [
'app/e2e/**/*.scenario.js'
];
config.capabilities = {
browserName: 'chrome',
};
config.capabilities.browserName = 'chrome';
exports.config = config;
+2848 -4793
View File
File diff suppressed because it is too large Load Diff
+7807 -10846
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -53,7 +53,7 @@
"gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1",
"jasmine-node": "^2.0.0",
"jasmine-reporters": "~1.0.1",
"jasmine-reporters": "^2.2.0",
"jshint-stylish": "~1.0.0",
"karma": "^0.13.19",
"karma-browserstack-launcher": "^0.1.8",
@@ -69,7 +69,7 @@
"marked": "~0.3.0",
"node-html-encoder": "0.0.2",
"promises-aplus-tests": "~2.1.0",
"protractor": "^2.1.0",
"protractor": "^4.0.11",
"q": "~1.0.0",
"q-io": "^1.10.9",
"qq": "^0.3.5",
+1 -3
View File
@@ -8,8 +8,6 @@ config.specs = [
'docs/app/e2e/**/*.scenario.js'
];
config.capabilities = {
browserName: 'chrome'
};
config.capabilities.browserName = 'chrome';
exports.config = config;
+5 -4
View File
@@ -15,7 +15,7 @@ exports.config = {
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
framework: 'jasmine2',
onPrepare: function() {
/* global angular: false, browser: false, jasmine: false */
@@ -29,9 +29,10 @@ exports.config = {
browser.addMockModule('disableNgAnimate', disableNgAnimate);
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('test_out/docs-e2e-' + exports.config.capabilities.browserName + '-', true, true));
var reporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new reporters.JUnitXmlReporter({
savePath: 'test_out/docs-e2e-' + exports.config.capabilities.browserName + '-'
}));
},
jasmineNodeOpts: {
+6 -1
View File
@@ -5,7 +5,12 @@ exports.config = {
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
framework: 'jasmine2',
capabilities: {
// Fix element scrolling behavior in Firefox for fixed header elements (like angularjs.org has)
'elementScrollBehavior': 1
},
onPrepare: function() {
/* global angular: false, browser: false, jasmine: false */
+7 -5
View File
@@ -13,7 +13,7 @@ if (process.env.BROWSER_PROVIDER === 'browserstack') {
}),
capabilitiesForBrowserStack({
browserName: 'firefox',
version: '28'
version: '47'
}),
capabilitiesForBrowserStack({
browserName: 'safari',
@@ -33,7 +33,7 @@ if (process.env.BROWSER_PROVIDER === 'browserstack') {
}),
capabilitiesForSauceLabs({
browserName: 'firefox',
version: '28'
version: '47'
}),
capabilitiesForSauceLabs({
browserName: 'safari',
@@ -54,7 +54,7 @@ function capabilitiesForBrowserStack(capabilities) {
return {
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
'browserstack.local' : 'true',
'browserstack.local': 'true',
'browserstack.debug': 'true',
'browserstack.tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
@@ -64,7 +64,8 @@ function capabilitiesForBrowserStack(capabilities) {
'browserName': capabilities.browserName,
'platform': capabilities.platform,
'version': capabilities.version
'version': capabilities.version,
'elementScrollBehavior': 1
};
}
@@ -77,6 +78,7 @@ function capabilitiesForSauceLabs(capabilities) {
'browserName': capabilities.browserName,
'platform': capabilities.platform,
'version': capabilities.version
'version': capabilities.version,
'elementScrollBehavior': 1
};
}
+11 -1
View File
@@ -1538,13 +1538,17 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
var nodeType = node.nodeType,
attrsMap = attrs.$attr,
match,
nodeName,
className;
switch (nodeType) {
case NODE_TYPE_ELEMENT: /* Element */
nodeName = nodeName_(node);
// use the node name: <directive>
addDirective(directives,
directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective);
// iterate over the attributes
for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
@@ -1585,6 +1589,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
attrEndName);
}
if (nodeName === 'input' && node.getAttribute('type') === 'hidden') {
// Hidden input elements can have strange behaviour when navigating back to the page
// This tells the browser not to try to cache and reinstate previous values
node.setAttribute('autocomplete', 'off');
}
// use class as directive
className = node.className;
if (isObject(className)) {
+2 -2
View File
@@ -627,12 +627,12 @@ function $SceDelegateProvider() {
* <file name="protractor.js" type="protractor">
* describe('SCE doc demo', function() {
* it('should sanitize untrusted values', function() {
* expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
* expect(element.all(by.css('.htmlComment')).first().getAttribute('innerHTML'))
* .toBe('<span>Is <i>anyone</i> reading this?</span>');
* });
*
* it('should NOT sanitize explicitly trusted values', function() {
* expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
* expect(element(by.id('explicitlyTrustedHtml')).getAttribute('innerHTML')).toBe(
* '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
* 'sanitization.&quot;">Hover over this text.</span>');
* });
+6 -6
View File
@@ -112,19 +112,19 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
</file>
<file name="protractor.js" type="protractor">
it('should sanitize the html snippet by default', function() {
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
});
it('should inline raw snippet if bound to a trusted value', function() {
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should escape snippet without any filter', function() {
expect(element(by.css('#bind-default div')).getInnerHtml()).
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).
toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
"&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
"snippet&lt;/p&gt;");
@@ -133,11 +133,11 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('new <b>text</b>');
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
'new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
"new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
});
</file>
+10
View File
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html ng-app>
<body>
<form>
<input type="hidden" value="{{value}}" />
<button ng-click="value = '{{ 7 * 6 }}'">Click me</button>
</form>
<script src="angular.js"></script>
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
describe('hidden thingy', function() {
it('should pass', function() {
loadFixture('input-hidden');
expect(element(by.css('input')).getAttribute('value')).toEqual('');
element(by.css('button')).click();
expect(element(by.css('input')).getAttribute('value')).toEqual('{{ 7 * 6 }}');
loadFixture('sample');
browser.driver.executeScript('history.back()');
var expectedValue = browser.params.browser === 'safari' ? '{{ 7 * 6 }}' : '';
expect(element(by.css('input')).getAttribute('value')).toEqual(expectedValue);
});
});
+19 -9
View File
@@ -138,16 +138,26 @@ describe('$log', function() {
describe('$log.error', function() {
var e, $log, errorArgs;
beforeEach(function() {
e = new Error('');
e.message = undefined;
e.sourceURL = undefined;
e.line = undefined;
e.stack = undefined;
function TestError() {
Error.prototype.constructor.apply(this, arguments);
this.message = undefined;
this.sourceURL = undefined;
this.line = undefined;
this.stack = undefined;
}
TestError.prototype = Object.create(Error.prototype);
TestError.prototype.constructor = TestError;
$log = new $LogProvider().$get[1]({console:{error:function() {
errorArgs = [].slice.call(arguments, 0);
}}});
beforeEach(function() {
e = new TestError('');
var mockWindow = {
console: {
error: function() {
errorArgs = [].slice.call(arguments, 0);
}
}
};
$log = new $LogProvider().$get[1](mockWindow);
});
+4 -3
View File
@@ -936,9 +936,10 @@ describe('ngMock', function() {
})();
function testCaller() {
return inject(function() {
throw new Error();
});
// Assigning to a local variable first, prevents Safari 10+ from inlining
// the function call and having it appear as anonymous in the stack trace.
var fn = inject(function() { throw new Error(); });
return fn;
}
var throwErrorFromInjectCallback = testCaller();