@@ -23,6 +23,7 @@ describe('a System Runtime component', function () {
2323 'fullName' : 'method' ,
2424 'testMethod' : 'method' ,
2525 'children' : 'collection' ,
26+ 'teacher' : 'link' ,
2627 'father' : 'link' ,
2728 'moving' : 'event'
2829 } ) ;
@@ -77,6 +78,12 @@ describe('a System Runtime component', function () {
7778 'mandatory' : false ,
7879 'default' : { }
7980 } ,
81+ 'teacher' : {
82+ 'type' : 'Person' ,
83+ 'readOnly' : false ,
84+ 'mandatory' : false ,
85+ 'default' : { }
86+ } ,
8087 'address' : {
8188 'type' : 'string' ,
8289 'readOnly' : false ,
@@ -487,7 +494,7 @@ describe('a System Runtime component', function () {
487494 expect ( yoda . birthDate ( ) . toISOString ( ) ) . equal ( now . toISOString ( ) ) ;
488495 } ) ;
489496
490- it ( 'can add a link to another components ' , function ( ) {
497+ it ( 'can add a link to another component ' , function ( ) {
491498 const Person = runtime . require ( 'Person' ) ;
492499
493500 const anakin = new Person ( {
@@ -505,7 +512,26 @@ describe('a System Runtime component', function () {
505512 expect ( leia . father ( ) . firstName ( ) ) . equal ( 'Anakin' ) ;
506513 } ) ;
507514
508- it ( 'can remove a link to another components' , function ( ) {
515+ it ( 'can add a link to another component that inherits from the valid class' , function ( ) {
516+ const Person = runtime . require ( 'Person' ) ;
517+ const Teacher = runtime . require ( 'Teacher' ) ;
518+
519+ const luke = new Person ( {
520+ 'firstName' : 'Luke' ,
521+ 'lastName' : 'Skywalker'
522+ } ) ;
523+
524+ const yoda = new Teacher ( {
525+ 'firstName' : 'Yoda' ,
526+ 'lastName' : 'Master'
527+ } ) ;
528+
529+ luke . teacher ( yoda ) ;
530+
531+ expect ( luke . teacher ( ) ) . to . not . be . undefined ;
532+ } ) ;
533+
534+ it ( 'can remove a link to another component' , function ( ) {
509535 const Person = runtime . require ( 'Person' ) ;
510536
511537 const anakin = new Person ( {
@@ -656,6 +682,25 @@ describe('a System Runtime component', function () {
656682 anakin . children ( [ ] ) ;
657683
658684 expect ( anakin . children ( ) . length ) . equal ( 0 ) ;
685+ } ) ; const Teacher = runtime . require ( 'Teacher' ) ;
686+
687+ it ( 'can add an item in a collection that inherits from the valid class' , function ( ) {
688+ const Person = runtime . require ( 'Person' ) ;
689+ const Teacher = runtime . require ( 'Teacher' ) ;
690+
691+ const vador = new Person ( {
692+ 'firstName' : 'Dark' ,
693+ 'lastName' : 'Vador'
694+ } ) ;
695+
696+ const luke = new Teacher ( {
697+ 'firstName' : 'Yoda' ,
698+ 'lastName' : 'Master'
699+ } ) ;
700+
701+ vador . children ( 0 , luke ) ;
702+
703+ expect ( vador . children ( 0 ) ) . to . not . be . undefined ;
659704 } ) ;
660705
661706 it ( 'can destroy itself' , function ( ) {
0 commit comments