Skip to content

Commit

Permalink
remove use of defer
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Nov 12, 2024
1 parent 8726a6e commit 2e076cb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions addon/components/tooltip.gjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { action } from '@ember/object';
import { cancel, later, next } from '@ember/runloop';
import { defer } from 'rsvp';
import { getPosition, getCoords } from '@zestia/position-utils';
import { guidFor } from '@ember/object/internals';
import { htmlSafe } from '@ember/template';
Expand Down Expand Up @@ -264,7 +263,7 @@ export default class TooltipComponent extends Component {
}

_renderTooltip() {
this.willInsertTooltip = defer();
this.willInsertTooltip = Promise.withResolvers();
this.shouldRenderTooltip = true;

return this.willInsertTooltip.promise;
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/components/tooltip/loading-attr-test.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render, triggerEvent, settled } from '@ember/test-helpers';
import Tooltip from '@zestia/ember-async-tooltips/components/tooltip';
import { defer } from 'rsvp';

module('tooltip | loading attributes', function (hooks) {
setupRenderingTest(hooks);

test('tooltip informs tooltipper it is loading', async function (assert) {
assert.expect(3);

const deferred = defer();
const deferred = Promise.withResolvers();

const load = () => deferred.promise;

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/components/tooltip/loading-data-test.gjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render, waitUntil, settled, triggerEvent } from '@ember/test-helpers';
import { defer } from 'rsvp';
import {
wait,
hasText,
Expand All @@ -15,7 +14,7 @@ module('tooltip | loading data', function (hooks) {
test('loading data', async function (assert) {
assert.expect(6);

const deferred = defer();
const deferred = Promise.withResolvers();

const load = () => {
assert.step('load tooltip');
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/components/tooltip/loading-error-test.gjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render, settled, triggerEvent } from '@ember/test-helpers';
import { defer } from 'rsvp';
import { tracked } from '@glimmer/tracking';
import Tooltip from '@zestia/ember-async-tooltips/components/tooltip';

Expand All @@ -11,8 +10,8 @@ module('tooltip | loading error', function (hooks) {
test('loading error', async function (assert) {
assert.expect(3);

const deferred1 = defer();
const deferred2 = defer();
const deferred1 = Promise.withResolvers();
const deferred2 = Promise.withResolvers();

const state = new (class {
@tracked load = () => deferred1.promise;
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/components/tooltip/rendering-test.gjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { settled, render, triggerEvent } from '@ember/test-helpers';
import { defer } from 'rsvp';
import { tracked } from '@glimmer/tracking';
import Tooltip from '@zestia/ember-async-tooltips/components/tooltip';

Expand Down Expand Up @@ -116,7 +115,7 @@ module('tooltip | rendering', function (hooks) {
@tracked show = true;
})();

const deferred = defer();
const deferred = Promise.withResolvers();

const load = () => deferred.promise;

Expand Down

0 comments on commit 2e076cb

Please sign in to comment.