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.
This commit is contained in:
Peter Bacon Darwin
2016-10-11 13:36:33 +01:00
parent cb04cfcab0
commit ff74511291
3 changed files with 6 additions and 34 deletions
+6 -9
View File
@@ -1708,16 +1708,13 @@ var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
return {
restrict: 'E',
require: ['?ngModel'],
compile: function(tElement, tAttr) {
if (lowercase(tAttr.type) === 'hidden') tAttr.$set('autocomplete', 'off');
return {
pre: function(scope, element, attr, ctrls) {
if (ctrls[0]) {
(inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
$browser, $filter, $parse);
}
link: {
pre: function(scope, element, attr, ctrls) {
if (ctrls[0]) {
(inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
$browser, $filter, $parse);
}
};
}
}
};
}];
-10
View File
@@ -1,10 +0,0 @@
<!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
@@ -1,15 +0,0 @@
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);
});
});