Skip to content

Commit ff56c2e

Browse files
WIP: simplest failing test
1 parent 7599625 commit ff56c2e

File tree

1 file changed

+134
-99
lines changed

1 file changed

+134
-99
lines changed

test/ng/compileSpec.js

+134-99
Original file line numberDiff line numberDiff line change
@@ -1443,125 +1443,159 @@ describe('$compile', function() {
14431443
}
14441444
));
14451445

1446-
iit('should pass the transcluded content through to ng-transclude', function() {
1446+
// it('should pass the transcluded content through to ng-transclude', function() {
1447+
1448+
// module(function($compileProvider) {
1449+
// // This directive transcludes its contents and hopes to use the
1450+
// // transcluded content in its template
1451+
// $compileProvider.directive('transTest', valueFn({
1452+
// templateUrl: 'transTestTemplate',
1453+
// transclude: true
1454+
// }));
1455+
// });
1456+
1457+
// inject(function($compile, $rootScope, $templateCache) {
1458+
// // This is the template for the trans-test directive, it contains an
1459+
// // ng-if, which also uses transclusion, which basically blocks the inner
1460+
// // trans-test directive from receiving any transcluded content
1461+
// $templateCache.put('transTestTemplate',
1462+
// ' <div ng-if="true">'+
1463+
// ' <div ng-transclude></div>'+
1464+
// '</div>');
1465+
1466+
// element = $compile('<div trans-test>transcluded content</div>')($rootScope);
1467+
1468+
// // The ngTransclude:orphan error gets thrown when the digest occurs since this
1469+
// // is when the ngTransclude directive tries to use the transcluded function.
1470+
// $rootScope.$digest();
1471+
1472+
// expect(element.text().trim()).toEqual('transcluded content');
1473+
// });
1474+
// });
1475+
1476+
1477+
// it('nested ngIfs should transclude correctly', function() {
1478+
1479+
// module(function($compileProvider) {
1480+
// // This directive does nothing except to put a directive in the compile
1481+
// // element ancestors list between the root $compile node and the trans-test
1482+
// // directives' element
1483+
// $compileProvider.directive('noop', valueFn({}));
1484+
// });
1485+
1486+
// inject(function($compile, $rootScope) {
1487+
// element = $compile('<div noop><div ng-if="true">outer<div ng-if="true">inner</div></div></div>')($rootScope);
1488+
1489+
// // The ngTransclude:orphan error gets thrown when the digest occurs since this
1490+
// // is when the ngTransclude directive tries to use the transcluded function.
1491+
// $rootScope.$digest();
1492+
1493+
// expect(element.text().trim()).toEqual('outerinner');
1494+
// });
1495+
// });
1496+
1497+
1498+
// it('should pass the transcluded content through to ng-transclude, ' +
1499+
// 'when not the highest directive' +
1500+
// 'and with external template', function() {
1501+
1502+
// module(function($compileProvider) {
1503+
// // This directive transcludes its contents and hopes to use the
1504+
// // transcluded content in its template
1505+
// $compileProvider.directive('transTest', valueFn({
1506+
// templateUrl: 'transTestTemplate',
1507+
// transclude: true
1508+
// }));
1509+
1510+
// // This directive does nothing except to put a directive in the compile
1511+
// // element ancestors list between the root $compile node and the trans-test
1512+
// // directives' element
1513+
// $compileProvider.directive('noop', valueFn({}));
1514+
// });
1515+
1516+
// inject(function($compile, $rootScope, $templateCache) {
1517+
// // This is the template for the trans-test directive, it contains an
1518+
// // ng-if, which also uses transclusion, which basically blocks the inner
1519+
// // trans-test directive from receiving any transcluded content
1520+
// $templateCache.put('transTestTemplate',
1521+
// '<div noop>'+
1522+
// ' <div ng-if="true">'+
1523+
// ' <div ng-transclude></div>'+
1524+
// ' </div>'+
1525+
// '</div>');
1526+
1527+
// element = $compile('<div trans-test>transcluded content</div>')($rootScope);
1528+
1529+
// // The ngTransclude:orphan error gets thrown when the digest occurs since this
1530+
// // is when the ngTransclude directive tries to use the transcluded function.
1531+
// $rootScope.$digest();
1532+
1533+
// expect(element.text().trim()).toEqual('transcluded content');
1534+
// });
1535+
// });
1536+
1537+
// it('should pass the transcluded content through to ng-transclude, ' +
1538+
// 'when not the highest directive' +
1539+
// 'and with inline template', function() {
1540+
1541+
// module(function($compileProvider) {
1542+
// // This directive transcludes its contents and hopes to use the
1543+
// // transcluded content in its template
1544+
// $compileProvider.directive('transTest', valueFn({
1545+
// template:
1546+
// // This is the template for the trans-test directive, it contains an
1547+
// // ng-if, which also uses transclusion, which basically blocks the inner
1548+
// // trans-test directive from receiving any transcluded content
1549+
// '<div noop>'+
1550+
// ' <div ng-if="true">'+
1551+
// ' <div ng-transclude></div>'+
1552+
// ' </div>'+
1553+
// '</div>',
1554+
// transclude: true
1555+
// }));
1556+
1557+
// // This directive does nothing except to put a directive in the compile
1558+
// // element ancestors list between the root $compile node and the trans-test
1559+
// // directives' element
1560+
// $compileProvider.directive('noop', valueFn({}));
1561+
// });
14471562

1448-
module(function($compileProvider) {
1449-
// This directive transcludes its contents and hopes to use the
1450-
// transcluded content in its template
1451-
$compileProvider.directive('transTest', valueFn({
1452-
templateUrl: 'transTestTemplate',
1453-
transclude: true
1454-
}));
1455-
});
1563+
// inject(function($compile, $rootScope, $templateCache) {
14561564

1457-
inject(function($compile, $rootScope, $templateCache) {
1458-
// This is the template for the trans-test directive, it contains an
1459-
// ng-if, which also uses transclusion, which basically blocks the inner
1460-
// trans-test directive from receiving any transcluded content
1461-
$templateCache.put('transTestTemplate',
1462-
' <div ng-if="true">'+
1463-
' <div ng-transclude></div>'+
1464-
'</div>');
1565+
// element = $compile('<div trans-test>transcluded content</div>')($rootScope);
14651566

1466-
element = $compile('<div trans-test>transcluded content</div>')($rootScope);
1567+
// // The ngTransclude:orphan error gets thrown when the digest occurs since this
1568+
// // is when the ngTransclude directive tries to use the transcluded function.
1569+
// $rootScope.$digest();
14671570

1468-
// The ngTransclude:orphan error gets thrown when the digest occurs since this
1469-
// is when the ngTransclude directive tries to use the transcluded function.
1470-
$rootScope.$digest();
1571+
// expect(element.text().trim()).toEqual('transcluded content');
1572+
// });
1573+
// });
14711574

1472-
expect(element.text().trim()).toEqual('transcluded content');
1473-
});
1474-
});
14751575

1476-
1477-
iit('nested ngIfs should transclude correctly', function() {
1576+
1577+
1578+
iit('should allow nested transclude directives', function() {
14781579

14791580
module(function($compileProvider) {
1480-
// This directive does nothing except to put a directive in the compile
1481-
// element ancestors list between the root $compile node and the trans-test
1482-
// directives' element
1483-
$compileProvider.directive('noop', valueFn({}));
1484-
});
1485-
1486-
inject(function($compile, $rootScope) {
1487-
element = $compile('<div noop><div ng-if="true">outer<div ng-if="true">inner</div></div></div>')($rootScope);
1488-
1489-
// The ngTransclude:orphan error gets thrown when the digest occurs since this
1490-
// is when the ngTransclude directive tries to use the transcluded function.
1491-
$rootScope.$digest();
1492-
1493-
expect(element.text().trim()).toEqual('outerinner');
1494-
});
1495-
});
14961581

1497-
iit('should pass the transcluded content through to ng-transclude, ' +
1498-
'when not the highest directive' +
1499-
'and with external template', function() {
1582+
$compileProvider.directive('noop', valueFn({}));
15001583

1501-
module(function($compileProvider) {
1502-
// This directive transcludes its contents and hopes to use the
1503-
// transcluded content in its template
1504-
$compileProvider.directive('transTest', valueFn({
1505-
templateUrl: 'transTestTemplate',
1584+
$compileProvider.directive('transclude1', valueFn({
1585+
template: '<div noop><div transclude2><div ng-transclude></div></div></div>',
15061586
transclude: true
15071587
}));
15081588

1509-
// This directive does nothing except to put a directive in the compile
1510-
// element ancestors list between the root $compile node and the trans-test
1511-
// directives' element
1512-
$compileProvider.directive('noop', valueFn({}));
1513-
});
1514-
1515-
inject(function($compile, $rootScope, $templateCache) {
1516-
// This is the template for the trans-test directive, it contains an
1517-
// ng-if, which also uses transclusion, which basically blocks the inner
1518-
// trans-test directive from receiving any transcluded content
1519-
$templateCache.put('transTestTemplate',
1520-
'<div noop>'+
1521-
' <div ng-if="true">'+
1522-
' <div ng-transclude></div>'+
1523-
' </div>'+
1524-
'</div>');
1525-
1526-
element = $compile('<div trans-test>transcluded content</div>')($rootScope);
1527-
1528-
// The ngTransclude:orphan error gets thrown when the digest occurs since this
1529-
// is when the ngTransclude directive tries to use the transcluded function.
1530-
$rootScope.$digest();
1531-
1532-
expect(element.text().trim()).toEqual('transcluded content');
1533-
});
1534-
});
1535-
1536-
iit('should pass the transcluded content through to ng-transclude, ' +
1537-
'when not the highest directive' +
1538-
'and with inline template', function() {
1539-
1540-
module(function($compileProvider) {
1541-
// This directive transcludes its contents and hopes to use the
1542-
// transcluded content in its template
1543-
$compileProvider.directive('transTest', valueFn({
1544-
template:
1545-
// This is the template for the trans-test directive, it contains an
1546-
// ng-if, which also uses transclusion, which basically blocks the inner
1547-
// trans-test directive from receiving any transcluded content
1548-
'<div noop>'+
1549-
' <div ng-if="true">'+
1550-
' <div ng-transclude></div>'+
1551-
' </div>'+
1552-
'</div>',
1589+
$compileProvider.directive('transclude2', valueFn({
1590+
template: '<div ng-transclude></div>',
15531591
transclude: true
15541592
}));
15551593

1556-
// This directive does nothing except to put a directive in the compile
1557-
// element ancestors list between the root $compile node and the trans-test
1558-
// directives' element
1559-
$compileProvider.directive('noop', valueFn({}));
15601594
});
15611595

15621596
inject(function($compile, $rootScope, $templateCache) {
15631597

1564-
element = $compile('<div trans-test>transcluded content</div>')($rootScope);
1598+
element = $compile('<div transclude1>transcluded content</div>')($rootScope);
15651599

15661600
// The ngTransclude:orphan error gets thrown when the digest occurs since this
15671601
// is when the ngTransclude directive tries to use the transcluded function.
@@ -1572,6 +1606,7 @@ describe('$compile', function() {
15721606
});
15731607

15741608

1609+
15751610
it("should fail if replacing and template doesn't have a single root element", function() {
15761611
module(function($exceptionHandlerProvider) {
15771612
$exceptionHandlerProvider.mode('log');

0 commit comments

Comments
 (0)