-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[CLEANUP] Deprecate Comparable mixin and remove internal usage #21437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| import { compare, typeOf } from '@ember/utils'; | ||
| import EmberObject from '@ember/object'; | ||
| import { Comparable } from '@ember/-internals/runtime'; | ||
| import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
|
||
| let data = []; | ||
| let Comp = EmberObject.extend(Comparable); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this part could be extracted to a separate pr tho ❤️
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d prefer to keep this here because after adding the deprecation this test fails if it keeps using |
||
| let Comp = EmberObject.extend(); | ||
|
|
||
| Comp.reopenClass({ | ||
| compare(obj) { | ||
|
|
@@ -84,5 +83,12 @@ moduleFor( | |
| assert.equal(compare('b', zero), 0, 'Second item comparable - returns 0 (negated)'); | ||
| assert.equal(compare('c', one), -1, 'Second item comparable - returns 1 (negated)'); | ||
| } | ||
|
|
||
| ['@test non-function compare does not make an object comparable'](assert) { | ||
| let obj = EmberObject.create({ compare: null }); | ||
| let other = EmberObject.create({ compare: 'not a function' }); | ||
|
|
||
| assert.equal(compare(obj, other), 0, 'objects with non-function compare are not comparable'); | ||
| } | ||
| } | ||
| ); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cant be deleted until after a major after a deprecation lands -- like:
https://github.com/emberjs/ember.js/pull/20702/changes#diff-aa3f9176575f028f979266539b2a7647d98ec70c72162bd89de74f863c857f8b
and then at the major we can remove like here:
#20891