mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 20:34:09 +00:00
[Time Conductor] Test restoration of old values
...and clarify name of the function in scope which does this.
This commit is contained in:
parent
02050fa3ef
commit
248bc68f0d
@ -23,7 +23,7 @@
|
|||||||
ng-controller="DateTimeFieldController">
|
ng-controller="DateTimeFieldController">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="textValue"
|
ng-model="textValue"
|
||||||
ng-blur="restoreValue(); ngBlur()"
|
ng-blur="restoreTextValue(); ngBlur()"
|
||||||
ng-class="{ error: textInvalid }">
|
ng-class="{ error: textInvalid }">
|
||||||
</input>
|
</input>
|
||||||
<a class="ui-symbol icon icon-calendar"
|
<a class="ui-symbol icon icon-calendar"
|
||||||
|
@ -82,12 +82,12 @@ define(
|
|||||||
updateFromModel($scope.ngModel[$scope.field]);
|
updateFromModel($scope.ngModel[$scope.field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreValue() {
|
function restoreTextValue() {
|
||||||
$scope.textValue = $scope.lastValidValue;
|
$scope.textValue = $scope.lastValidValue;
|
||||||
updateFromView($scope.textValue);
|
updateFromView($scope.textValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.restoreValue = restoreValue;
|
$scope.restoreTextValue = restoreTextValue;
|
||||||
|
|
||||||
$scope.picker = { active: false };
|
$scope.picker = { active: false };
|
||||||
|
|
||||||
|
@ -126,11 +126,12 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when user input is invalid", function () {
|
describe("when user input is invalid", function () {
|
||||||
var newText, oldValue;
|
var newText, oldText, oldValue;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
newText = "Not a date";
|
newText = "Not a date";
|
||||||
oldValue = mockScope.ngModel.testField;
|
oldValue = mockScope.ngModel.testField;
|
||||||
|
oldText = mockScope.textValue;
|
||||||
mockScope.textValue = newText;
|
mockScope.textValue = newText;
|
||||||
fireWatch("textValue", newText);
|
fireWatch("textValue", newText);
|
||||||
});
|
});
|
||||||
@ -146,6 +147,11 @@ define(
|
|||||||
it("does not modify user input", function () {
|
it("does not modify user input", function () {
|
||||||
expect(mockScope.textValue).toEqual(newText);
|
expect(mockScope.textValue).toEqual(newText);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("restores valid text values on request", function () {
|
||||||
|
mockScope.restoreTextValue();
|
||||||
|
expect(mockScope.textValue).toEqual(oldText);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not modify valid but irregular user input", function () {
|
it("does not modify valid but irregular user input", function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user