diff --git a/addon/components/hyper-table-v2/manage-columns.hbs b/addon/components/hyper-table-v2/manage-columns.hbs index 6feb5b55..a5eede67 100644 --- a/addon/components/hyper-table-v2/manage-columns.hbs +++ b/addon/components/hyper-table-v2/manage-columns.hbs @@ -4,73 +4,75 @@ @label={{t "hypertable.features.manage_fields.title"}} {{on "click" this.toggleAvailableFields}} /> -
-
-
-
{{t "hypertable.features.manage_fields.all_fields"}}
- -
- {{#each this._columnCategories as |category|}} + {{#if this.displayAvailableFields}} +
+
-
{{category}}
+
{{t "hypertable.features.manage_fields.all_fields"}}
- {{/each}} -
-
- -
- {{#each-in this.orderedFilteredClusters as |clusterName fields|}} - {{#if clusterName}} -
- {{clusterName}} -
- {{/if}} - {{#each fields as |field|}} -
- {{#if field.isLoading}} -
- {{else}} - - {{/if}} -
- {{field.definition.name}} +
+ +
+ {{#each-in this.orderedFilteredClusters as |clusterName fields|}} + {{#if clusterName}} +
+ {{clusterName}} +
+ {{/if}} + {{#each fields as |field|}} +
+ {{#if field.isLoading}} +
+ {{else}} + + {{/if}} +
+ {{field.definition.name}} +
+ {{/each}} + {{else}} +
+ {{t "hypertable.features.manage_fields.no_columns"}}
- {{/each}} - {{else}} -
- {{t "hypertable.features.manage_fields.no_columns"}} -
- {{/each-in}} + {{/each-in}} +
-
+ {{/if}}
\ No newline at end of file diff --git a/addon/components/hyper-table-v2/manage-columns.ts b/addon/components/hyper-table-v2/manage-columns.ts index 6dcfd120..43d2f540 100644 --- a/addon/components/hyper-table-v2/manage-columns.ts +++ b/addon/components/hyper-table-v2/manage-columns.ts @@ -6,6 +6,7 @@ import { action } from '@ember/object'; import { isEmpty } from '@ember/utils'; import TableHandler from '@upfluence/hypertable/core/handler'; import { ColumnDefinition } from '@upfluence/hypertable/core/interfaces'; +import { later, next } from '@ember/runloop'; type ManagedColumn = { definition: ColumnDefinition; @@ -22,6 +23,7 @@ export default class HyperTableV2ManageColumns extends Component { + this.dropdownVisibility = 'visible'; + }); + } } @action closeAvailableFields(): void { - this.displayAvailableFields = false; + this.dropdownVisibility = 'invisible'; + later( + this, + () => { + this.displayAvailableFields = false; + }, + 300 + ); } @action diff --git a/tests/integration/components/hyper-table-v2/manage-columns-test.ts b/tests/integration/components/hyper-table-v2/manage-columns-test.ts index d78f5dc8..6042834a 100644 --- a/tests/integration/components/hyper-table-v2/manage-columns-test.ts +++ b/tests/integration/components/hyper-table-v2/manage-columns-test.ts @@ -1,7 +1,7 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { setupIntl, type TestContext } from 'ember-intl/test-support'; -import { click, fillIn, render } from '@ember/test-helpers'; +import { click, fillIn, render, waitFor } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import { RowsFetcher, TableManager } from '@upfluence/hypertable/test-support'; import TableHandler from '@upfluence/hypertable/core/handler'; @@ -54,15 +54,17 @@ module('Integration | Component | hyper-table-v2/manage-columns', function (hook await this.handler.fetchColumns(); }); - test('it renders', async function (assert) { + test('fields are not rendered in the DOM initially', async function (assert) { await render(hbs``); - assert.dom('.available-fields-wrapper.invisible').exists({ count: 1 }); + + assert.dom('.available-fields-wrapper').doesNotExist(); }); - module('when a user clicks on manage column button', function () { + module('when a user clicks on manage column button, it is rendered', function () { test('it should open the available columns', async function (assert) { await render(hbs``); await click('.upf-btn.upf-btn--default'); + await waitFor('.available-fields-wrapper.visible'); assert.dom('.available-fields-wrapper.visible').exists({ count: 1 }); });