From 2bf311edc8b482961f54c204f180d559abb82d89 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 23 Feb 2022 13:54:23 +0000 Subject: [PATCH] Updated label filtering test to check labels column is populated correctly no issue - updated assertions to check that labels are shown inside the labels column when filtering members list by label - added a member serializer to mirage so that relationships are correctly expanded to full embedded records --- ghost/admin/mirage/serializers/member.js | 15 +++++++++++++++ .../admin/tests/acceptance/members/filter-test.js | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 ghost/admin/mirage/serializers/member.js diff --git a/ghost/admin/mirage/serializers/member.js b/ghost/admin/mirage/serializers/member.js new file mode 100644 index 0000000000..a831c2232e --- /dev/null +++ b/ghost/admin/mirage/serializers/member.js @@ -0,0 +1,15 @@ +import BaseSerializer from './application'; + +export default BaseSerializer.extend({ + embed: true, + + include(request) { + let queryIncludes = (request.queryParams.include || '').split(',').compact(); + const includes = new Set(queryIncludes); + + // embedded records that are included by default in the API + includes.add('labels'); + + return Array.from(includes); + } +}); diff --git a/ghost/admin/tests/acceptance/members/filter-test.js b/ghost/admin/tests/acceptance/members/filter-test.js index f4146c2f82..de4627b750 100644 --- a/ghost/admin/tests/acceptance/members/filter-test.js +++ b/ghost/admin/tests/acceptance/members/filter-test.js @@ -96,7 +96,11 @@ describe('Acceptance: Members filtering', function () { expect(findAll('[data-test-list="members-list-item"]').length, `# of filtered member rows - ${label.name}`) .to.equal(3); + + // table shows labels column+data expect(find('[data-test-table-column="label"]')).to.exist; + expect(findAll('[data-test-table-data="label"]').length).to.equal(3); + expect(find('[data-test-table-data="label"]')).to.contain.text(label.name); // can delete filter await click('[data-test-delete-members-filter="0"]');