|
76 | 76 | * <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.js"> |
77 | 77 | * <file name="index.html"> |
78 | 78 | * <div ng-controller="AppController"> |
79 | | - Select recipients:<br> |
80 | | - <select multiple size=5 ng-model="recipients" ng-options="person as person.name for person in people"> |
81 | | - </select><br> |
| 79 | + * <button ng-click="recipients.pop()" id="decreaseRecipients">decreaseRecipients</button><br> |
| 80 | + * Select recipients:<br> |
| 81 | + * <select multiple size=5 ng-model="recipients" ng-options="person as person.name for person in people"> |
| 82 | + * </select><br> |
82 | 83 | * <p>{{recipients.length, plural, offset:1 |
83 | 84 | * =0 {{{sender.name}} gave no gifts (\#=#)} |
84 | 85 | * =1 {{{sender.name}} gave a gift to {{recipients[0].name}} (\#=#)} |
|
110 | 111 | * |
111 | 112 | * <file name="protractor.js" type="protractor"> |
112 | 113 | * describe('MessageFormat plural', function() { |
113 | | - * function clickOptionCtrl(select, index) { |
114 | | - * element.all(by.css('select option')).then(function(arr) { |
115 | | - browser.actions() |
116 | | - .mouseMove(arr[index]) |
117 | | - .keyDown(protractor.Key.CONTROL) |
118 | | - .click() |
119 | | - .keyUp(protractor.Key.CONTROL) |
120 | | - .perform(); |
121 | | - }); |
122 | | - * } |
123 | 114 | * |
124 | 115 | * it('should pluralize initial values', function() { |
125 | 116 | * var messageElem = element(by.binding('recipients.length')), |
126 | | - * select = element(by.css('select')); |
| 117 | + * decreaseRecipientsBtn = element(by.id('decreaseRecipients')); |
127 | 118 | * |
128 | 119 | * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and 2 other people a gift (#=2)'); |
129 | | - clickOptionCtrl(select, 2); |
| 120 | + * decreaseRecipientsBtn.click(); |
130 | 121 | * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and one other person a gift (#=1)'); |
131 | | - clickOptionCtrl(select, 1); |
| 122 | + * decreaseRecipientsBtn.click(); |
132 | 123 | * expect(messageElem.getText()).toEqual('Harry Potter gave a gift to Alice (#=0)'); |
133 | | - clickOptionCtrl(select, 0); |
| 124 | + * decreaseRecipientsBtn.click(); |
134 | 125 | * expect(messageElem.getText()).toEqual('Harry Potter gave no gifts (#=-1)'); |
135 | 126 | * }); |
136 | 127 | * }); |
|
0 commit comments