Skip to content

Commit

Permalink
Merge pull request #438 from job13er/fix-frost-toggle-click-handler
Browse files Browse the repository at this point in the history
Fix frost toggle click handler
  • Loading branch information
job13er authored Apr 27, 2017
2 parents f147fb4 + 44d3c17 commit dccc7a3
Show file tree
Hide file tree
Showing 57 changed files with 569 additions and 556 deletions.
2 changes: 1 addition & 1 deletion .bithoundrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"critics": {
"lint": {"engine": "none"}
}
},
"dependencies": {
"mute": ["ember-cli"]
}
Expand Down
23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
extends: ['frost-standard'],
globals: {
CSS: true
},
rules: {
'ocd/sort-import-declarations': [
2,
{
localPrefixes: [
'../',
'./',
'dummy/',
'ember-frost-core/'
]
}
]
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ before_script:

script:
- $(npm root -g)/pr-bumper/.travis/maybe-test.sh
- .travis/maybe-check-coverage.sh
- .travis/maybe-bump-version.sh

after_success:
Expand Down
15 changes: 15 additions & 0 deletions .travis/maybe-check-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

if [ "$TRAVIS_NODE_VERSION" != "6.9.1" ]
then
echo "Skipping version bump for TRAVIS_NODE_VERSION ${TRAVIS_NODE_VERSION}"
exit 0
fi

if [ "$EMBER_TRY_SCENARIO" != "default" ]
then
echo "Skipping version bump for EMBER_TRY_SCENARIO ${EMBER_TRY_SCENARIO}"
exit 0
fi

$(npm root -g)/pr-bumper/.travis/maybe-check-coverage.sh
2 changes: 0 additions & 2 deletions addon/components/frost-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ export default Component.extend({

// == DOM Events ============================================================

// FIXME: jsdoc
onclick: on('click', function (event) {
if (!ViewUtils.isSimpleClick(event)) {
return true
Expand All @@ -221,7 +220,6 @@ export default Component.extend({
}
}),

// FIXME: jsdoc
_onFocus: on('focusIn', function (e) {
// If an onFocus handler is defined, call it
if (this.attrs.onFocus) {
Expand Down
1 change: 0 additions & 1 deletion addon/components/frost-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default Component.extend(FrostEventsProxy, {

// == Tasks =================================================================

// FIXME: jsdoc
_toggleReveal: task(function * (isVisible) {
this.toggleProperty('isRevealed')

Expand Down
3 changes: 0 additions & 3 deletions addon/components/frost-radio-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export default Component.extend({

// == Functions ===============================================================

// FIXME: jsdoc
_changeTarget (event, target) {
const e = cloneEvent(event, target)

Expand All @@ -122,7 +121,6 @@ export default Component.extend({

// == Events ===============================================================
/* eslint-disable complexity */
// FIXME: jsdoc
keyPress (event) {
if (event.keyCode === 13 || event.keyCode === 32) {
if (this.get('disabled') || this.get('checked')) {
Expand All @@ -136,7 +134,6 @@ export default Component.extend({
},
/* eslint-enable complexity */

// FIXME: jsdoc
change (event) {
if (this.onChange) {
this.onChange(this._changeTarget(event, event.target))
Expand Down
10 changes: 1 addition & 9 deletions addon/components/frost-select-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {keyCodes} from '../utils'
import {trimLongDataInElement} from '../utils/text'
import Component from './frost-component'

const {DOWN_ARROW, ENTER, TAB, ESCAPE, UP_ARROW} = keyCodes
const {DOWN_ARROW, ENTER, ESCAPE, TAB, UP_ARROW} = keyCodes

const BORDER_HEIGHT = 1
const ARROW_HEIGHT = 12
Expand Down Expand Up @@ -266,7 +266,6 @@ export default Component.extend({
})
},

// FIXME: jsdoc
_getElementDimensionsAndPosition ($element) {
const height = $element.height()
const offset = $element.offset()
Expand All @@ -283,7 +282,6 @@ export default Component.extend({
}
},

// FIXME: jsdoc
_handleArrowKey (upArrow) {
let focusedIndex = this.get('focusedIndex')

Expand All @@ -308,7 +306,6 @@ export default Component.extend({
}
},

// FIXME: jsdoc
_handleEnterKey () {
const items = this.get('items') || []
const focusedIndex = this.get('focusedIndex')
Expand Down Expand Up @@ -371,7 +368,6 @@ export default Component.extend({
},

/* eslint-disable complexity */
// FIXME: jsdoc
_updatePosition ($element) {
if (this.isDestroyed || this.isDestroying) return {}

Expand Down Expand Up @@ -447,7 +443,6 @@ export default Component.extend({

// == Tasks =================================================================

// FIXME: jsdoc
updateTask: task(function * () {
this._isUpdating = true

Expand Down Expand Up @@ -554,7 +549,6 @@ export default Component.extend({
// == Actions ===============================================================

actions: {
// FIXME: jsdoc
clear (e) {
this.get('onSelect')([])

Expand All @@ -563,13 +557,11 @@ export default Component.extend({
$('.frost-select-dropdown .frost-text-input').focus()
},

// FIXME: jsdoc
mouseDown (e) {
// This keeps the overlay from swallowing clicks on the clear button
e.preventDefault()
},

// FIXME: jsdoc
selectItem (value) {
// Single select
if (!this.get('multiselect')) {
Expand Down
10 changes: 0 additions & 10 deletions addon/components/frost-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export default Component.extend({

@readOnly
@computed('data', 'filter', 'onInput')
// FIXME: jsdoc
items (data, filter, onInput) {
// If no data to filter we are done
if (!data) {
Expand Down Expand Up @@ -187,7 +186,6 @@ export default Component.extend({

@readOnly
@computed('data', 'selected', 'internalSelectedValue')
// FIXME: jsdoc
selectedItems (items, selected, selectedValue) {
if (selectedValue !== undefined) {
return items.filter((item) => {
Expand Down Expand Up @@ -277,14 +275,12 @@ export default Component.extend({

// == DOM Events ============================================================

// FIXME: jsdoc
_onClick: on('click', function () {
if (!this.get('disabled')) {
this.toggleProperty('opened')
}
}),

// FIXME: jsdoc
_onKeyDown: on('keyDown', function (e) {
if (
[DOWN_ARROW, UP_ARROW].indexOf(e.keyCode) !== -1 &&
Expand All @@ -296,7 +292,6 @@ export default Component.extend({
}
}),

// FIXME: jsdoc
_onKeyPress: on('keyPress', function (e) {
if (e.keyCode === SPACE) {
e.preventDefault() // Keep space from scrolling page
Expand All @@ -305,7 +300,6 @@ export default Component.extend({
}
}),

// FIXME: jsdoc
_onFocusIn: on('focusIn', function () {
// If select is disabled make sure it can't get focus
if (this.get('disabled')) {
Expand All @@ -321,7 +315,6 @@ export default Component.extend({
}
}),

// FIXME: jsdoc
_onFocusOut: on('focusOut', function () {
// We must use run.later so filter text input has time to focus when select
// dropdown is being opened
Expand Down Expand Up @@ -393,7 +386,6 @@ export default Component.extend({
// == Actions ===============================================================

actions: {
// FIXME: jsdoc
closeDropDown () {
this.setProperties({
filter: '',
Expand All @@ -405,7 +397,6 @@ export default Component.extend({
this.$().focus()
},

// FIXME: jsdoc
filterInput (e) {
const inputTask = this.get('inputTask')
const onInput = this.get('onInput')
Expand All @@ -419,7 +410,6 @@ export default Component.extend({
}
},

// FIXME: jsdoc
selectItem (selectedValue) {
const isMultiselect = this.get('multiselect')
const props = {
Expand Down
6 changes: 0 additions & 6 deletions addon/components/frost-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ export default Component.extend(FrostEventsProxyMixin, {

// == Tasks ==================================================================

// FIXME: jsdoc
_clear: task(function * () {
this.$('input')
.focus()
.val('')
.trigger('input')
}).restartable(),

// FIXME: jsdoc
_showClear: task(function * (isFocused) {
const showClear = isFocused && isPresent(this.get('value')) && !this.get('readonly')
if (this.get('isClearVisible') === showClear) {
Expand All @@ -102,7 +100,6 @@ export default Component.extend(FrostEventsProxyMixin, {

// == DOM Events ============================================================

// FIXME: jsdoc
_showClearEvent: on('focusIn', 'focusOut', 'input', function (event) {
const isFocused = event.type !== 'focusout'
this.get('_showClear').perform(isFocused)
Expand All @@ -126,19 +123,16 @@ export default Component.extend(FrostEventsProxyMixin, {
// To avoid this, we use the TextSupport 'key-up' event and
// proxy the event to the keyUp handler.
actions: {
// FIXME: jsdoc
clear () {
this.get('_clear').perform()
},

// FIXME: jsdoc
keyUp (value, event) {
if (isPresent(this.get('_eventProxy.keyUp'))) {
this._eventProxy.keyUp(event)
}
},

// FIXME: jsdoc
_onInput (event) {
if (isPresent(this.get('_eventProxy.input'))) {
// Add id and value for legacy support
Expand Down
6 changes: 0 additions & 6 deletions addon/components/frost-textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ export default Component.extend(FrostEventsProxyMixin, {

// == Tasks ==================================================================

// FIXME: jsdoc
_clear: task(function * () {
this.$('textarea')
.focus()
.val('')
.trigger('input')
}).restartable(),

// FIXME: jsdoc
_showClear: task(function * (isFocused) {
const showClear = isFocused && isPresent(this.get('value')) && !this.get('readonly')
if (this.get('isClearVisible') === showClear) {
Expand All @@ -97,7 +95,6 @@ export default Component.extend(FrostEventsProxyMixin, {

// == DOM Events ============================================================

// FIXME: jsdoc
_showClearEvent: on('focusIn', 'focusOut', 'input', function (event) {
const isFocused = event.type !== 'focusout'
this.get('_showClear').perform(isFocused)
Expand All @@ -108,7 +105,6 @@ export default Component.extend(FrostEventsProxyMixin, {
// == Actions ===============================================================

actions: {
// FIXME: jsdoc
clear () {
this.get('_clear').perform()
},
Expand All @@ -118,14 +114,12 @@ export default Component.extend(FrostEventsProxyMixin, {
// TextSupport events (i.e. 'enter' and 'escape') don't fire.
// To avoid this, we use the TextSupport 'key-up' event and
// proxy the event to the keyUp handler.
// FIXME: jsdoc
keyUp (value, event) {
if (isPresent(this.get('_eventProxy.keyUp'))) {
this._eventProxy.keyUp(event)
}
},

// FIXME: jsdoc
_onInput (event) {
if (isPresent(this.get('_eventProxy.input'))) {
// Add id and value for legacy support
Expand Down
Loading

0 comments on commit dccc7a3

Please sign in to comment.