Skip to content

Commit 6f1b6c2

Browse files
Separate decorator-factory-service-test
1 parent 2ca1dd3 commit 6f1b6c2

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ module.exports = function(config) {
2626
'src/directives/decorators/bootstrap/*.js',
2727
'src/**/*.html',
2828
'test/schema-form-test.js',
29-
'test/service-test.js'
29+
'test/service-test.js',
30+
'test/decorator-factory-service-test.js',
3031
],
3132

3233
// list of files to exclude
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
describe('decorator factory service',function(){
2+
beforeEach(module('templates'));
3+
beforeEach(module('schemaForm'));
4+
5+
it('should enable you to create new decorator directives',function(){
6+
module(function(schemaFormDecoratorsProvider){
7+
schemaFormDecoratorsProvider.createDecorator('foobar',{ 'foo':'/bar.html' },[angular.noop]);
8+
});
9+
10+
inject(function($rootScope,$compile,$templateCache){
11+
$templateCache.put('/bar.html','<div class="yes">YES</div>');
12+
13+
//Since our directive does a replace we need a wrapper to actually check the content.
14+
var templateWithWrap = angular.element('<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>');
15+
var template = templateWithWrap.children().eq(0);
16+
17+
$compile(template)($rootScope);
18+
$rootScope.$apply();
19+
templateWithWrap.children().length.should.equal(1);
20+
templateWithWrap.children().is('foobar').should.be.true;
21+
templateWithWrap.children().eq(0).children().length.should.equal(1);
22+
templateWithWrap.children().eq(0).children().is('div').should.be.true;
23+
templateWithWrap.children().eq(0).children().hasClass('yes').should.be.true;
24+
25+
});
26+
});
27+
});

test/schema-form-test.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,37 +1615,4 @@ describe('Schema form',function(){
16151615
});
16161616

16171617
});
1618-
1619-
1620-
1621-
1622-
describe('decorator factory service',function(){
1623-
beforeEach(module('templates'));
1624-
beforeEach(module('schemaForm'));
1625-
1626-
it('should enable you to create new decorator directives',function(){
1627-
module(function(schemaFormDecoratorsProvider){
1628-
schemaFormDecoratorsProvider.createDecorator('foobar',{ 'foo':'/bar.html' },[angular.noop]);
1629-
});
1630-
1631-
inject(function($rootScope,$compile,$templateCache){
1632-
$templateCache.put('/bar.html','<div class="yes">YES</div>');
1633-
1634-
//Since our directive does a replace we need a wrapper to actually check the content.
1635-
var templateWithWrap = angular.element('<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>');
1636-
var template = templateWithWrap.children().eq(0);
1637-
1638-
$compile(template)($rootScope);
1639-
$rootScope.$apply();
1640-
templateWithWrap.children().length.should.equal(1);
1641-
templateWithWrap.children().is('foobar').should.be.true;
1642-
templateWithWrap.children().eq(0).children().length.should.equal(1);
1643-
templateWithWrap.children().eq(0).children().is('div').should.be.true;
1644-
templateWithWrap.children().eq(0).children().hasClass('yes').should.be.true;
1645-
1646-
});
1647-
});
1648-
});
1649-
1650-
16511618
});

0 commit comments

Comments
 (0)