Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeError: this.i18n is not a function
- at UsersCtrl.$onInit (test-context.js:35081:41)
- at Object.<anonymous> (test-context.js:35031:31)
- class UsersCtrl {
- constructor($filter) {
- this.i18n = $filter('i18n');
- this.users = [];
- }
- //Life cycle Hooks: Initialization
- $onInit() {
- this.users = [
- {name: this.i18n('USERS')}
- ];
- }
- }
- UsersCtrl.$inject = ['$filter'];
- angular.module('app', []).controller('UsersCtrl',UsersCtrl);
- export default UsersCtrl;
- Import UsersCtrl from './users-controller.js';
- describe("given a new User Page", () => {
- var UserController;
- beforeEach(() => {
- angular.mock.module('app');
- });
- describe("when initialising has completed", () => {
- beforeEach(() => {
- inject(($rootScope, $controller, $filter) => {
- const scope = $rootScope.$new();
- const filter = $filter
- UserController = $controller("UsersCtrl", { $scope: scope, $filter: filter});
- });
- });
- it("then users array for tab content should be empty initially",() => {
- const expectedActive = [];
- expect(UserController.users).toEqual(expectedActive);
- });
- });
- });
Add Comment
Please, Sign In to add comment