From afd11a4e03238aaa01f5038a77dafde7b647c367 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Tue, 12 Nov 2024 11:31:13 +0100 Subject: [PATCH] Resolve the action helper/modifier deprecation More info: https://deprecations.emberjs.com/id/template-action --- .../au-data-table/number-pagination.hbs | 4 +- .../au-data-table/number-pagination.js | 12 +- .../components/au-data-table/th-sortable.hbs | 6 +- addon/components/au-data-table/th-sortable.js | 40 +++--- .../au-data-table-number-pagination-test.js | 115 ++++++++++++++++++ .../au-data-table-th-sortable-test.js | 67 ++++++++++ 6 files changed, 211 insertions(+), 33 deletions(-) create mode 100644 tests/integration/components/au-data-table/au-data-table-number-pagination-test.js create mode 100644 tests/integration/components/au-data-table/au-data-table-th-sortable-test.js diff --git a/addon/components/au-data-table/number-pagination.hbs b/addon/components/au-data-table/number-pagination.hbs index a7cbd0ff0..9167ef08a 100644 --- a/addon/components/au-data-table/number-pagination.hbs +++ b/addon/components/au-data-table/number-pagination.hbs @@ -13,7 +13,7 @@ vorige {{this.pageSize}} rijen @@ -26,7 +26,7 @@ @skin="link" @icon={{this.NavRightIcon}} @iconAlignment="right" - {{action "changePage" this.links.next}} + {{on "click" (fn this.changePage this.links.next)}} > volgende {{this.pageSize}} rijen diff --git a/addon/components/au-data-table/number-pagination.js b/addon/components/au-data-table/number-pagination.js index fc00054d9..3126458d5 100644 --- a/addon/components/au-data-table/number-pagination.js +++ b/addon/components/au-data-table/number-pagination.js @@ -1,6 +1,6 @@ -/* eslint-disable ember/no-actions-hash, ember/no-classic-classes, ember/no-classic-components, ember/no-get, ember/require-tagless-components */ +/* eslint-disable ember/no-classic-classes, ember/no-classic-components, ember/no-get, ember/require-tagless-components */ import Component from '@ember/component'; -import { computed } from '@ember/object'; +import { action, computed } from '@ember/object'; import { gt } from '@ember/object/computed'; import { NavLeftIcon } from '../icons/nav-left'; import { NavRightIcon } from '../icons/nav-right'; @@ -44,11 +44,9 @@ const NumberPagination = Component.extend({ (val, index) => this.firstPage + index, ); }), - actions: { - changePage(link) { - this.set('page', link['number'] || 0); - }, - }, + changePage: action(function (link) { + this.set('page', link['number'] || 0); + }), }); export default NumberPagination.extend({ diff --git a/addon/components/au-data-table/th-sortable.hbs b/addon/components/au-data-table/th-sortable.hbs index 81700e7bb..39ad806dd 100644 --- a/addon/components/au-data-table/th-sortable.hbs +++ b/addon/components/au-data-table/th-sortable.hbs @@ -6,7 +6,7 @@ {{#if (eq this.order "desc")}}