@@ -7,7 +7,7 @@ import { VirtualRepeat } from '../src/virtual-repeat';
77PLATFORM . moduleName ( 'src/virtual-repeat' ) ;
88PLATFORM . moduleName ( 'test/noop-value-converter' ) ;
99
10- fdescribe ( 'VirtualRepeat Integration' , ( ) => {
10+ describe ( 'VirtualRepeat Integration' , ( ) => {
1111 const itemHeight = 100 ;
1212 const nq = createAssertionQueue ( ) ;
1313
@@ -80,8 +80,10 @@ fdescribe('VirtualRepeat Integration', () => {
8080 } ) ;
8181
8282 afterEach ( ( ) => {
83- if ( component ) {
84- return component . cleanUp ( ) ;
83+ try {
84+ component . cleanUp ( ) ;
85+ } catch ( ex ) {
86+ console . log ( 'Error cleaning up component' ) ;
8587 }
8688 } ) ;
8789
@@ -92,7 +94,6 @@ fdescribe('VirtualRepeat Integration', () => {
9294 virtualRepeat = component . sut ;
9395 viewModel = component . viewModel ;
9496 } ) ;
95- const element = virtualRepeat [ 'element' ] ;
9697 const { topBuffer, bottomBuffer } = virtualRepeat ;
9798 expect ( topBuffer . nextElementSibling . tagName ) . toBe ( 'TBODY' ) ;
9899 expect ( topBuffer . tagName ) . toBe ( 'TR' ) ;
@@ -127,6 +128,36 @@ fdescribe('VirtualRepeat Integration', () => {
127128 done . fail ( ex ) ;
128129 }
129130 } ) ;
131+
132+ it ( 'works with static row' , async done => {
133+ try {
134+ component . inView (
135+ // there is a small border spacing between tbodies, rows that will add up
136+ // need to add border spacing 0 for testing purposes
137+ `<table style="border-spacing: 0">
138+ <tr><td>Name</td></tr>
139+ <tbody virtual-repeat.for="item of items">
140+ <tr style="height: ${ itemHeight } px;"><td>\${item}</td></tr>
141+ </tbody>
142+ </table>` ) ;
143+
144+ await component . create ( ) . then ( ( ) => {
145+ virtualRepeat = component . sut ;
146+ viewModel = component . viewModel ;
147+ } ) ;
148+ const element = virtualRepeat [ 'element' ] ;
149+ const table = element . parentNode ;
150+ expect ( table . firstElementChild ) . toBe ( virtualRepeat . topBuffer . previousElementSibling ) ;
151+ expect ( table . firstElementChild . innerHTML . trim ( ) ) . toBe ( '<tr><td>Name</td></tr>' ) ;
152+ nq ( ( ) => validateState ( virtualRepeat , viewModel , itemHeight ) ) ;
153+ nq ( ( ) => validatePush ( virtualRepeat , viewModel , ( ) => {
154+
155+ done ( ) ;
156+ } ) ) ;
157+ } catch ( ex ) {
158+ done . fail ( ex ) ;
159+ }
160+ } ) ;
130161 } ) ;
131162
132163 function validatePush ( virtualRepeat : VirtualRepeat , viewModel : any , done : Function ) {
0 commit comments