mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 16:10:23 +00:00
[Search] Remove invalid specs
This commit is contained in:
@ -133,15 +133,6 @@ define([
|
|||||||
expect(mockScope.loading).toBeFalsy();
|
expect(mockScope.loading).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
xit('displays only some results when there are many', function () {
|
|
||||||
expect(mockPromise.then).toHaveBeenCalledWith(jasmine.any(Function));
|
|
||||||
mockPromise.then.mostRecentCall.args[0]({hits: bigArray(100)});
|
|
||||||
|
|
||||||
expect(mockScope.results).toBeDefined();
|
|
||||||
expect(mockScope.results.length).toBeLessThan(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('detects when there are more results', function () {
|
it('detects when there are more results', function () {
|
||||||
mockPromise.then.mostRecentCall.args[0]({
|
mockPromise.then.mostRecentCall.args[0]({
|
||||||
hits: bigArray(controller.RESULTS_PER_PAGE),
|
hits: bigArray(controller.RESULTS_PER_PAGE),
|
||||||
@ -149,7 +140,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(mockScope.results.length).toBe(controller.RESULTS_PER_PAGE);
|
expect(mockScope.results.length).toBe(controller.RESULTS_PER_PAGE);
|
||||||
expect(controller.areMore()).toBeTruthy;
|
expect(controller.areMore()).toBeTruthy();
|
||||||
|
|
||||||
controller.loadMore();
|
controller.loadMore();
|
||||||
|
|
||||||
@ -170,50 +161,6 @@ define([
|
|||||||
expect(controller.areMore()).toBe(false);
|
expect(controller.areMore()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('can load more results', function () {
|
|
||||||
var oldSize;
|
|
||||||
|
|
||||||
expect(mockPromise.then).toHaveBeenCalled();
|
|
||||||
mockPromise.then.mostRecentCall.args[0]({
|
|
||||||
hits: bigArray(INITIAL_LOAD_NUMBER + LOAD_INCREMENT + 1),
|
|
||||||
total: INITIAL_LOAD_NUMBER + LOAD_INCREMENT + 1
|
|
||||||
});
|
|
||||||
// These hits and total lengths are the case where the controller
|
|
||||||
// DOES NOT have to re-search to load more results
|
|
||||||
oldSize = mockScope.results.length;
|
|
||||||
|
|
||||||
expect(controller.areMore()).toBeTruthy();
|
|
||||||
|
|
||||||
controller.loadMore();
|
|
||||||
expect(mockScope.results.length).toBeGreaterThan(oldSize);
|
|
||||||
});
|
|
||||||
|
|
||||||
xit('can re-search to load more results', function () {
|
|
||||||
var oldSize,
|
|
||||||
oldCallCount;
|
|
||||||
|
|
||||||
expect(mockPromise.then).toHaveBeenCalled();
|
|
||||||
mockPromise.then.mostRecentCall.args[0]({
|
|
||||||
hits: bigArray(INITIAL_LOAD_NUMBER + LOAD_INCREMENT - 1),
|
|
||||||
total: INITIAL_LOAD_NUMBER + LOAD_INCREMENT + 1
|
|
||||||
});
|
|
||||||
// These hits and total lengths are the case where the controller
|
|
||||||
// DOES have to re-search to load more results
|
|
||||||
oldSize = mockScope.results.length;
|
|
||||||
oldCallCount = mockPromise.then.callCount;
|
|
||||||
expect(controller.areMore()).toBeTruthy();
|
|
||||||
|
|
||||||
controller.loadMore();
|
|
||||||
expect(mockPromise.then).toHaveBeenCalled();
|
|
||||||
// Make sure that a NEW call to search has been made
|
|
||||||
expect(oldCallCount).toBeLessThan(mockPromise.then.callCount);
|
|
||||||
mockPromise.then.mostRecentCall.args[0]({
|
|
||||||
hits: bigArray(INITIAL_LOAD_NUMBER + LOAD_INCREMENT + 1),
|
|
||||||
total: INITIAL_LOAD_NUMBER + LOAD_INCREMENT + 1
|
|
||||||
});
|
|
||||||
expect(mockScope.results.length).toBeGreaterThan(oldSize);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sets the ngModel.search flag', function () {
|
it('sets the ngModel.search flag', function () {
|
||||||
// Flag should be true with nonempty input
|
// Flag should be true with nonempty input
|
||||||
expect(mockScope.ngModel.search).toEqual(true);
|
expect(mockScope.ngModel.search).toEqual(true);
|
||||||
|
Reference in New Issue
Block a user