Skip to content

Commit b9bfd65

Browse files
authored
Remove dropdown option from calculatePosition (#1031)
* Remove passing component class to calculatePosition * Fix lint * Add in docs * Improve docs * Fix lint
1 parent 3bc6847 commit b9bfd65

4 files changed

Lines changed: 18 additions & 12 deletions

File tree

docs/app/templates/public-pages/docs/migrate-8-0-to-9-0.gts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ import { LinkTo } from '@ember/routing';
4141
<code>sass-embedded</code>.
4242
</p>
4343
</li>
44+
<li>
45+
<p>
46+
The
47+
<code>dropdown</code>
48+
option has been removed from
49+
<code>calculatePosition</code>. Previously, this option passed the
50+
current class instance to
51+
<code>calculatePosition</code>.<br />
52+
Note: This option was never documented.
53+
</p>
54+
</li>
4455
<li>
4556
<p>
4657
Passing

ember-basic-dropdown/src/components/basic-dropdown.gts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ export default class BasicDropdown extends Component<BasicDropdownSignature> {
306306
previousVerticalPosition,
307307
renderInPlace,
308308
matchTriggerWidth,
309-
dropdown: this,
310309
},
311310
);
312311
return this.applyReposition(triggerElement, dropdownElement, positionData);

ember-basic-dropdown/src/utils/calculate-position.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type BasicDropdown from '../components/basic-dropdown.gts';
21
import type { VerticalPosition, HorizontalPosition } from '../types.ts';
32

43
// To avoid breaking the current types export we need this
@@ -11,7 +10,6 @@ export interface CalculatePositionOptions {
1110
previousHorizontalPosition?: HorizontalPosition | undefined;
1211
previousVerticalPosition?: VerticalPosition | undefined;
1312
renderInPlace: boolean;
14-
dropdown: BasicDropdown;
1513
}
1614

1715
export type CalculatePositionResultStyle = {

test-app/tests/integration/components/basic-dropdown-test.gts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,13 +1057,8 @@ module('Integration | Component | basic-dropdown', function (hooks) {
10571057
const self = this;
10581058

10591059
assert.expect(4);
1060-
this.calculatePosition = function (
1061-
_triggerElement,
1062-
_dropdownElement,
1063-
_destinationElement,
1064-
{ dropdown },
1065-
) {
1066-
assert.ok(dropdown, 'dropdown should be passed to the component');
1060+
this.calculatePosition = function () {
1061+
assert.ok('custom calculatePosition was passed to the component');
10671062
return {
10681063
horizontalPosition: 'right',
10691064
verticalPosition: 'above',
@@ -1118,9 +1113,12 @@ module('Integration | Component | basic-dropdown', function (hooks) {
11181113
_triggerElement,
11191114
_dropdownElement,
11201115
_destinationElement,
1121-
{ dropdown, renderInPlace },
1116+
{ renderInPlace },
11221117
) {
1123-
assert.ok(dropdown, 'dropdown should be passed to the component');
1118+
assert.ok(
1119+
renderInPlace,
1120+
'custom calculatePosition with renderInPlace was passed to the component',
1121+
);
11241122
if (renderInPlace) {
11251123
return {
11261124
horizontalPosition: 'right',

0 commit comments

Comments
 (0)