|
50 | 50 | ctrl = $controller(ctrlName, { $scope: scope }); |
51 | 51 | })); |
52 | 52 |
|
53 | | - it('should not have any properties from data', function () { |
| 53 | + it('should have `data` properties on scope but not directly on controller', function () { |
54 | 54 | expect(scope.foo).toBeDefined(); |
55 | 55 | expect(ctrl.foo).toBeUndefined(); |
56 | 56 |
|
57 | 57 | expect(scope.bar).toBeDefined(); |
58 | 58 | expect(ctrl.bar).toBeUndefined(); |
59 | 59 | }); |
60 | 60 |
|
61 | | - it('should not have any properties from methods', function () { |
| 61 | + it('should not have methods on scope but does have methods directly on controller', function () { |
62 | 62 | expect(scope.fooMethod).toBeUndefined(); |
63 | 63 | expect(ctrl.fooMethod).toBeDefined(); |
64 | 64 |
|
|
78 | 78 |
|
79 | 79 | }); |
80 | 80 |
|
| 81 | + describe('Classy Plugin Options', function () { |
| 82 | + |
| 83 | + beforeEach(module('options-classy-shorthand')); |
| 84 | + |
| 85 | + describe('first controller', function() { |
| 86 | + var ctrl, scope; |
| 87 | + var ctrlName = 'optionsOne'; |
| 88 | + |
| 89 | + beforeEach(inject(function ($controller, $rootScope) { |
| 90 | + scope = $rootScope.$new(); |
| 91 | + ctrl = $controller(ctrlName, { $scope: scope }); |
| 92 | + })); |
| 93 | + |
| 94 | + it('should not have any properties from data', function () { |
| 95 | + expect(scope.foo).toBeUndefined(); |
| 96 | + expect(ctrl.foo).toBeUndefined(); |
| 97 | + |
| 98 | + expect(scope.bar).toBeUndefined(); |
| 99 | + expect(ctrl.bar).toBeUndefined(); |
| 100 | + }); |
| 101 | + |
| 102 | + it('should not have any properties from methods', function () { |
| 103 | + expect(scope.fooMethod).toBeUndefined(); |
| 104 | + expect(ctrl.fooMethod).toBeUndefined(); |
| 105 | + |
| 106 | + expect(scope.barMethod).toBeUndefined(); |
| 107 | + expect(ctrl.barMethod).toBeUndefined(); |
| 108 | + }); |
| 109 | + |
| 110 | + |
| 111 | + it('should have `baz` property on scope and class', function () { |
| 112 | + expect(scope.baz).toBeDefined(); |
| 113 | + expect(ctrl.baz).toBeDefined(); |
| 114 | + }); |
| 115 | + |
| 116 | + |
| 117 | + }); |
| 118 | + |
| 119 | + |
| 120 | + describe('second controller', function() { |
| 121 | + var ctrl, scope; |
| 122 | + var ctrlName = 'optionsTwo'; |
| 123 | + |
| 124 | + beforeEach(inject(function ($controller, $rootScope) { |
| 125 | + scope = $rootScope.$new(); |
| 126 | + ctrl = $controller(ctrlName, { $scope: scope }); |
| 127 | + })); |
| 128 | + |
| 129 | + it('should have `data` properties on scope but not directly on controller', function () { |
| 130 | + expect(scope.foo).toBeDefined(); |
| 131 | + expect(ctrl.foo).toBeUndefined(); |
| 132 | + |
| 133 | + expect(scope.bar).toBeDefined(); |
| 134 | + expect(ctrl.bar).toBeUndefined(); |
| 135 | + }); |
| 136 | + |
| 137 | + it('should have methods on scope but not directly on controller', function () { |
| 138 | + expect(scope.fooMethod).toBeDefined(); |
| 139 | + expect(ctrl.fooMethod).toBeUndefined(); |
| 140 | + |
| 141 | + expect(scope.barMethod).toBeDefined(); |
| 142 | + expect(ctrl.barMethod).toBeUndefined(); |
| 143 | + }); |
| 144 | + |
| 145 | + |
| 146 | + it('should have `baz` property on scope and class', function () { |
| 147 | + expect(scope.baz).toBeDefined(); |
| 148 | + expect(ctrl.baz).toBeDefined(); |
| 149 | + }); |
| 150 | + |
| 151 | + |
| 152 | + }); |
| 153 | + |
| 154 | + |
| 155 | + }); |
| 156 | + |
| 157 | + |
81 | 158 | }()); |
0 commit comments