mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 13:17:53 +00:00
Merge pull request #1135 from vankessel/open1117
[Search] 'All' checked upon no filters. Fixes #1117
This commit is contained in:
commit
597d66782e
@ -80,7 +80,7 @@ define(function () {
|
|||||||
// If there's still nothing in the filters string, there are no
|
// If there's still nothing in the filters string, there are no
|
||||||
// filters selected
|
// filters selected
|
||||||
if ($scope.ngModel.filtersString === '') {
|
if ($scope.ngModel.filtersString === '') {
|
||||||
$scope.ngModel.filtersString = 'NONE';
|
$scope.ngModel.checkAll = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,12 +95,11 @@ define(function () {
|
|||||||
$scope.ngModel.checked[type] = false;
|
$scope.ngModel.checked[type] = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Change the filters string depending on checkAll status
|
|
||||||
if ($scope.ngModel.checkAll) {
|
|
||||||
// This setting will make the filters display hidden
|
// This setting will make the filters display hidden
|
||||||
$scope.ngModel.filtersString = '';
|
$scope.ngModel.filtersString = '';
|
||||||
} else {
|
// Do not let checkAll become unchecked when it is the only checked filter
|
||||||
$scope.ngModel.filtersString = 'NONE';
|
if (!$scope.ngModel.checkAll) {
|
||||||
|
$scope.ngModel.checkAll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-filter results
|
// Re-filter results
|
||||||
|
@ -76,14 +76,16 @@ define(
|
|||||||
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("changing checkAll status updates the filter string", function () {
|
it("changing checkAll status sets checkAll to true", function () {
|
||||||
controller.checkAll();
|
controller.checkAll();
|
||||||
|
expect(mockScope.ngModel.checkAll).toEqual(true);
|
||||||
expect(mockScope.ngModel.filtersString).toEqual('');
|
expect(mockScope.ngModel.filtersString).toEqual('');
|
||||||
|
|
||||||
mockScope.ngModel.checkAll = false;
|
mockScope.ngModel.checkAll = false;
|
||||||
|
|
||||||
controller.checkAll();
|
controller.checkAll();
|
||||||
expect(mockScope.ngModel.filtersString).toEqual('NONE');
|
expect(mockScope.ngModel.checkAll).toEqual(true);
|
||||||
|
expect(mockScope.ngModel.filtersString).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("checking checkAll option resets other options", function () {
|
it("checking checkAll option resets other options", function () {
|
||||||
@ -97,7 +99,7 @@ define(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("tells the user when no options are checked", function () {
|
it("checks checkAll when no options are checked", function () {
|
||||||
Object.keys(mockScope.ngModel.checked).forEach(function (type) {
|
Object.keys(mockScope.ngModel.checked).forEach(function (type) {
|
||||||
mockScope.ngModel.checked[type] = false;
|
mockScope.ngModel.checked[type] = false;
|
||||||
});
|
});
|
||||||
@ -105,7 +107,8 @@ define(
|
|||||||
|
|
||||||
controller.updateOptions();
|
controller.updateOptions();
|
||||||
|
|
||||||
expect(mockScope.ngModel.filtersString).toEqual('NONE');
|
expect(mockScope.ngModel.filtersString).toEqual('');
|
||||||
|
expect(mockScope.ngModel.checkAll).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("tells the user when options are checked", function () {
|
it("tells the user when options are checked", function () {
|
||||||
@ -116,7 +119,6 @@ define(
|
|||||||
|
|
||||||
controller.updateOptions();
|
controller.updateOptions();
|
||||||
|
|
||||||
expect(mockScope.ngModel.filtersString).not.toEqual('NONE');
|
|
||||||
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user