diff --git a/addon-test-support/interactor.js b/addon-test-support/interactor.js index f20fde6a..27ff5cf8 100644 --- a/addon-test-support/interactor.js +++ b/addon-test-support/interactor.js @@ -1,8 +1,7 @@ import { triggerEvent } from '@ember/test-helpers'; -import $ from 'jquery'; -const MONTH_SELECTOR = '.pika-lendar:visible .pika-select-month'; -const YEAR_SELECTOR = '.pika-lendar:visible .pika-select-year'; +const MONTH_SELECTOR = '.pika-lendar .pika-select-month'; +const YEAR_SELECTOR = '.pika-lendar .pika-select-year'; /** * @param {Date} date @@ -13,42 +12,39 @@ export async function selectDate(date) { const year = date.getFullYear(); const selectEvent = 'ontouchend' in document ? 'touchend' : 'mousedown'; - $(YEAR_SELECTOR).val(year); - await triggerEvent($(YEAR_SELECTOR)[0], 'change'); + const yearElement = document.querySelector(YEAR_SELECTOR); + yearElement.value = year; + await triggerEvent(yearElement, 'change'); - $(MONTH_SELECTOR).val(month); - await triggerEvent($(MONTH_SELECTOR)[0], 'change'); + const monthElement = document.querySelector(MONTH_SELECTOR); + monthElement.value = month; + await triggerEvent(monthElement, 'change'); await triggerEvent( - $( - 'td[data-day="' + day + '"]:not(.is-outside-current-month) button:visible' - )[0], + document.querySelector( + 'td[data-day="' + day + '"]:not(.is-outside-current-month) button' + ), selectEvent ); } export function selectedDay() { - return $('.pika-single td.is-selected button').html(); + return document.querySelector('.pika-single td.is-selected button').innerHTML; } export function selectedMonth() { - return $(MONTH_SELECTOR + ' option:selected').val(); + return document.querySelector(MONTH_SELECTOR).value; } export function selectedYear() { - return $(YEAR_SELECTOR + ' option:selected').val(); + return document.querySelector(YEAR_SELECTOR).value; } export function minimumYear() { - return $(YEAR_SELECTOR) - .children() - .first() - .val(); + return document.querySelector(YEAR_SELECTOR).options[0].value; } export function maximumYear() { - return $(YEAR_SELECTOR) - .children() - .last() - .val(); + const options = document.querySelector(YEAR_SELECTOR).options; + return options[options.length - 1].value; } diff --git a/addon/components/pikaday-input.js b/addon/components/pikaday-input.js index fa6f5031..5c778fce 100644 --- a/addon/components/pikaday-input.js +++ b/addon/components/pikaday-input.js @@ -32,7 +32,10 @@ export default Component.extend(PikadayMixin, { }, onPikadayClose() { - if (this.get('pikaday').getDate() === null || isEmpty(this.$().val())) { + if ( + this.get('pikaday').getDate() === null || + isEmpty(this.get('element').value) + ) { this.set('value', null); this.get('onSelection')(null); } diff --git a/addon/components/pikaday-inputless.js b/addon/components/pikaday-inputless.js index 5bc0d1ac..851e77bd 100644 --- a/addon/components/pikaday-inputless.js +++ b/addon/components/pikaday-inputless.js @@ -6,8 +6,11 @@ export default Component.extend(PikadayMixin, { layout, didInsertElement() { - this.set('field', this.$('.ember-pikaday-input')[0]); - this.set('pikadayContainer', this.$('.ember-pikaday-container')[0]); + this.set('field', this.element.querySelector('.ember-pikaday-input')); + this.set( + 'pikadayContainer', + this.element.querySelector('.ember-pikaday-container') + ); this.setupPikaday(); }, diff --git a/package.json b/package.json index 33f0328b..23fc4001 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "test": "tests" }, "devDependencies": { - "@ember/jquery": "^0.5.2", "@ember/optional-features": "^0.6.3", "@ember/test-helpers": "^0.7.25", "broccoli-asset-rev": "^2.7.0", diff --git a/yarn.lock b/yarn.lock index 6f4ad35d..844cfa3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,15 +2,6 @@ # yarn lockfile v1 -"@ember/jquery@^0.5.2": - version "0.5.2" - resolved "https://registry.yarnpkg.com/@ember/jquery/-/jquery-0.5.2.tgz#fe312c03ada0022fa092d23f7cd7e2eb0374b53a" - dependencies: - broccoli-funnel "^2.0.1" - ember-cli-babel "^6.6.0" - jquery "^3.3.1" - resolve "^1.7.1" - "@ember/optional-features@^0.6.3": version "0.6.4" resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-0.6.4.tgz#8199f853c1781234fcb1f05090cddd0b822bff69"