Here is my unit test
describe('Filter', function () {
beforeEach(function () {
template = `<div class="workspace"><filter api-object="apiObject"></filter></div>`;
});
describe('default', function() {
it('attributes', function () {
scope.savedFilters = savedFilters;
scope.availableFiltersMap = {
name: true,
description: true
};
spyOn(ViewSelect, "getFilter").and.returnValue(scope.savedFilters);
element = test.compileElement(template, scope);
scope.$emit(scope.apiObject.id, true);
httpBackend.flush();
expect(scope.filters.length).toBe(2);
});
});
});
Here my intention to test filters
length but it's not available in direct scope
it's available in $$childhead
.
When I use scope.$$childhead.filters
it's throwing error Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Please help me why it is not accessible directly on the scope?
any help would be appreciated Please.
question from:
https://stackoverflow.com/questions/66056930/scope-not-accessible-in-unit-test-with-jasmine 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…