I am currently working with AngularJS 1.5+, jasmine, and karma, and I am facing an issue when testing a component along with its template. When the component's template is compiled, it seems to be missing the expected content.
Here is a snippet of the test code I have been using:
const ELEMENT_HTML = '<some-component></some-component>';
const scope = $rootScope.$new();
const markup = angular.element(ELEMENT_HTML);
const component = $compile(markup)(scope);
$scope.$digest();
console.log(component);
The some-component
template should contain some content, but the console.log
outputs only the specified ELEMENT_HTML
, without the actual content of the component. This happens even though the ELEMENT_HTML
includes regular HTML elements that should display the complete content of the component.
This issue could possibly be related to incorrect modules being used, although testing with $componentController
works as intended. The problem arises specifically when compiling and testing the component together with its template.
If needed, I can provide more information to help diagnose the problem.
Thank you,
Tomasz.