Skip to content

Commit

Permalink
refactor: remove iron-resizable-behavior from combo-box (#3195) (#3455)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomi Virkki <[email protected]>
  • Loading branch information
web-padawan and tomivirkki authored Feb 16, 2022
1 parent a34e0ef commit 50901fd
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 26 deletions.
1 change: 0 additions & 1 deletion packages/combo-box/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
],
"dependencies": {
"@open-wc/dedupe-mixin": "^1.3.0",
"@polymer/iron-resizable-behavior": "^3.0.0",
"@polymer/polymer": "^3.0.0",
"@vaadin/component-base": "^22.0.4",
"@vaadin/field-base": "^22.0.4",
Expand Down
12 changes: 1 addition & 11 deletions packages/combo-box/src/vaadin-combo-box-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import './vaadin-combo-box-item.js';
import './vaadin-combo-box-overlay.js';
import './vaadin-combo-box-scroller.js';
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';

/**
Expand All @@ -16,7 +14,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
* @extends HTMLElement
* @private
*/
export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, PolymerElement) {
export class ComboBoxDropdown extends PolymerElement {
static get is() {
return 'vaadin-combo-box-dropdown';
}
Expand Down Expand Up @@ -171,14 +169,6 @@ export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, Poly
this._overlayOpened = false;
}

notifyResize() {
super.notifyResize();

if (this.positionTarget && this.opened) {
this._setOverlayWidth();
}
}

_fireTouchAction(sourceEvent) {
this.dispatchEvent(
new CustomEvent('vaadin-overlay-touch-action', {
Expand Down
7 changes: 0 additions & 7 deletions packages/combo-box/src/vaadin-combo-box-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,6 @@ export const ComboBoxMixin = (subclass) =>

/** @private */
_onOpened() {
setTimeout(() => this._resizeDropdown(), 1);

// Defer scroll position adjustment to improve performance.
requestAnimationFrame(() => {
this.$.dropdown.adjustScrollPosition();
Expand Down Expand Up @@ -842,11 +840,6 @@ export const ComboBoxMixin = (subclass) =>
}
}

/** @private */
_resizeDropdown() {
this.$.dropdown.notifyResize();
}

/** @private */
_selectedItemChanged(selectedItem) {
if (selectedItem === null || selectedItem === undefined) {
Expand Down
1 change: 1 addition & 0 deletions packages/combo-box/test/combo-box-light.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import '@polymer/polymer/lib/elements/dom-repeat.js';
import '@vaadin/text-field/vaadin-text-field.js';
import '@vaadin/polymer-legacy-adapter/template-renderer.js';
import './not-animated-styles.js';
Expand Down
7 changes: 0 additions & 7 deletions packages/combo-box/test/filtering.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,6 @@ describe('filtering items', () => {
expect(overlay.hasAttribute('loading')).to.be.false;
});

it('should not notify resize the dropdown if not opened', () => {
const resizeSpy = sinon.spy(comboBox.$.dropdown, 'notifyResize');
comboBox.filteredItems = ['foo', 'bar', 'baz'];

expect(resizeSpy.called).to.be.false;
});

it('should not perform measurements when loading changes if not opened', () => {
const measureSpy = sinon.spy(comboBox.inputElement, 'getBoundingClientRect');
comboBox.loading = true;
Expand Down

0 comments on commit 50901fd

Please sign in to comment.