refactor(widgets): remove input[button, submit, reset, image] and button windgets

These widgets are useless and only trigger extra $updateViews.

The only reason we had them was to support ng:change on these widgets,
but since there are no bindings present in these cases it doesn't make
sense to support ng:change here. It's likely just a leftover from
getangular.com

Breaking change: ng:change for input[button], input[submit], input[reset], input[image]
and button widgets is not supported any more
This commit is contained in:
Di Peng 2011-08-05 15:01:58 -07:00 committed by Igor Minar
parent 862d78c1d9
commit 142cffcf64
2 changed files with 1 additions and 18 deletions

View file

@ -445,16 +445,11 @@ function noopAccessor() { return { get: noop, set: noop }; }
*
*/
var textWidget = inputWidget('keydown change', modelAccessor, valueAccessor, initWidgetValue(), true),
buttonWidget = inputWidget('click', noopAccessor, noopAccessor, noop),
INPUT_TYPE = {
'text': textWidget,
'textarea': textWidget,
'hidden': textWidget,
'password': textWidget,
'button': buttonWidget,
'submit': buttonWidget,
'reset': buttonWidget,
'image': buttonWidget,
'checkbox': inputWidget('click', modelFormattedAccessor, checkedAccessor, initWidgetValue(false)),
'radio': inputWidget('click', modelFormattedAccessor, radioAccessor, radioInit),
'select-one': inputWidget('change', modelAccessor, valueAccessor, initWidgetValue(null)),
@ -566,7 +561,7 @@ function inputWidgetSelector(element){
angularWidget('input', inputWidgetSelector);
angularWidget('textarea', inputWidgetSelector);
angularWidget('button', inputWidgetSelector);
/**
* @workInProgress

View file

@ -295,18 +295,6 @@ describe("widget", function(){
expect(scope.name).toEqual('Kai');
});
it('should call ng:change on button click', function(){
compile('<input type="button" value="Click Me" ng:change="clicked = true"/>');
browserTrigger(element);
expect(scope.clicked).toEqual(true);
});
it('should support button alias', function(){
compile('<button ng:change="clicked = true">Click {{"Me"}}.</button>');
browserTrigger(element);
expect(scope.clicked).toEqual(true);
expect(scope.$element.text()).toEqual("Click Me.");
});
describe('radio', function(){