Guest User

Untitled

a guest
Sep 25th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. TypeError: this.i18n is not a function
  2. at UsersCtrl.$onInit (test-context.js:35081:41)
  3. at Object.<anonymous> (test-context.js:35031:31)
  4.  
  5. class UsersCtrl {
  6. constructor($filter) {
  7. this.i18n = $filter('i18n');
  8. this.users = [];
  9. }
  10. //Life cycle Hooks: Initialization
  11. $onInit() {
  12. this.users = [
  13. {name: this.i18n('USERS')}
  14. ];
  15. }
  16. }
  17. UsersCtrl.$inject = ['$filter'];
  18.  
  19. angular.module('app', []).controller('UsersCtrl',UsersCtrl);
  20.  
  21. export default UsersCtrl;
  22.  
  23. Import UsersCtrl from './users-controller.js';
  24.  
  25. describe("given a new User Page", () => {
  26. var UserController;
  27. beforeEach(() => {
  28. angular.mock.module('app');
  29. });
  30.  
  31. describe("when initialising has completed", () => {
  32. beforeEach(() => {
  33. inject(($rootScope, $controller, $filter) => {
  34. const scope = $rootScope.$new();
  35. const filter = $filter
  36. UserController = $controller("UsersCtrl", { $scope: scope, $filter: filter});
  37. });
  38. });
  39. it("then users array for tab content should be empty initially",() => {
  40. const expectedActive = [];
  41. expect(UserController.users).toEqual(expectedActive);
  42. });
  43. });
  44. });
Add Comment
Please, Sign In to add comment