diff --git a/addon/-private/index.js b/addon/-private/index.js index 3aa7e00b..3a3c3ca2 100644 --- a/addon/-private/index.js +++ b/addon/-private/index.js @@ -4,6 +4,7 @@ export { default as closestElement } from './utils/element/closest'; export { default as DynamicRadar } from './data-view/radar/dynamic-radar'; export { default as StaticRadar } from './data-view/radar/static-radar'; +export { default as VirtualComponent } from './data-view/elements/virtual-component'; export { default as ViewportContainer } from './data-view/viewport-container'; export { default as objectAt } from './data-view/utils/object-at'; diff --git a/addon/components/vertical-collection/component.js b/addon/components/vertical-collection/component.js index 1b262336..7aabfb8c 100644 --- a/addon/components/vertical-collection/component.js +++ b/addon/components/vertical-collection/component.js @@ -149,6 +149,15 @@ const VerticalCollection = Component.extend({ */ occlusionTagName: 'occluded-content', + RadarClass: computed({ + get() { + return this._RadarClass || this.staticHeight ? StaticRadar : DynamicRadar; + }, + set(_, value) { + return this._RadarClass = value; + } + }), + isEmpty: empty('items'), shouldYieldToInverse: readOnly('isEmpty'), @@ -217,7 +226,7 @@ const VerticalCollection = Component.extend({ this._super(); this.token = new Token(); - const RadarClass = this.staticHeight ? StaticRadar : DynamicRadar; + const RadarClass = this.get('RadarClass'); const items = this.get('items') || []; diff --git a/tests/integration/basic-test.js b/tests/integration/basic-test.js index 2bcf51d9..38bb1f6e 100644 --- a/tests/integration/basic-test.js +++ b/tests/integration/basic-test.js @@ -7,6 +7,7 @@ import { } from 'ember-native-dom-helpers'; import wait from 'ember-test-helpers/wait'; +import { StaticRadar } from '@html-next/vertical-collection/-private'; import getNumbers from 'dummy/lib/get-numbers'; import { @@ -353,3 +354,32 @@ testScenarios( assert.equal(scrollContainer.scrollTop, 500, 'scroll position remains the same'); } ); + +test('The collection renders with a RadarClass set', async function(assert) { + assert.expect(1); + + class CustomRadarClass extends StaticRadar {} + + this.setProperties({ + items: getNumbers(0, 10), + customRadarClass: CustomRadarClass + }); + + this.render(hbs` +