-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix MandatorySetter error for Proxied PromiseProxy, silence embe…
…r-concurrency deprecations (#8206) * npm ignore publish for yarn-error.log * dont wrap in deprecation proxy in prod builds * add failing test to replicate bug * add fix * restore original deprecation * cleanup * more cleanup * dont deprecate for ec, fix prod test
- Loading branch information
Showing
5 changed files
with
148 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/-ember-data/tests/acceptance/tracking-promise-flags-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { render, settled } from '@ember/test-helpers'; | ||
|
||
import hbs from 'htmlbars-inline-precompile'; | ||
import { module } from 'qunit'; | ||
|
||
import { setupRenderingTest } from 'ember-qunit'; | ||
|
||
import JSONAPIAdapter from '@ember-data/adapter/json-api'; | ||
import Model, { attr } from '@ember-data/model'; | ||
import Store from '@ember-data/store'; | ||
import { deprecatedTest } from '@ember-data/unpublished-test-infra/test-support/deprecated-test'; | ||
|
||
class Widget extends Model { | ||
@attr name; | ||
} | ||
|
||
module('acceptance/tracking-promise-flags', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
hooks.beforeEach(function () { | ||
let { owner } = this; | ||
owner.register('service:store', Store); | ||
owner.register('model:widget', Widget); | ||
owner.register( | ||
'serializer:application', | ||
class { | ||
normalizeResponse = (_, __, data) => data; | ||
static create() { | ||
return new this(); | ||
} | ||
} | ||
); | ||
}); | ||
|
||
deprecatedTest( | ||
'can track isPending', | ||
{ id: 'ember-data:deprecate-promise-proxies', until: '5.0', count: 6 }, | ||
async function (assert) { | ||
const { owner } = this; | ||
let resolve; | ||
class TestAdapter extends JSONAPIAdapter { | ||
findRecord() { | ||
return new Promise((r) => { | ||
resolve = r; | ||
}); | ||
} | ||
} | ||
owner.register('adapter:application', TestAdapter); | ||
let store = owner.lookup('service:store'); | ||
store.DISABLE_WAITER = true; | ||
this.model = store.findRecord('widget', '1'); | ||
|
||
await render(hbs`{{#if this.model.isPending}}Pending{{else}}{{this.model.name}}{{/if}}`); | ||
|
||
assert.dom().containsText('Pending'); | ||
|
||
resolve({ | ||
data: { | ||
id: '1', | ||
type: 'widget', | ||
attributes: { | ||
name: 'Contraption', | ||
}, | ||
}, | ||
}); | ||
await settled(); | ||
|
||
assert.dom().containsText('Contraption'); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters