Skip to content

Commit

Permalink
Merge 8015e8d into 7c2d5a4
Browse files Browse the repository at this point in the history
  • Loading branch information
juwara0 committed Nov 3, 2017
2 parents 7c2d5a4 + 8015e8d commit aeb5612
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 60 deletions.
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
5 changes: 2 additions & 3 deletions addon/components/frost-fixed-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import Ember from 'ember'
const {isNone} = Ember
import computed, {readOnly} from 'ember-computed-decorators'
import {Component} from 'ember-frost-core'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import SelectionMixin from '../mixins/selection'
import TableMixin from '../mixins/table'
import layout from '../templates/components/frost-fixed-table'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

export default Component.extend(SelectionMixin, TableMixin, {
// == Dependencies ==========================================================
Expand Down
5 changes: 2 additions & 3 deletions addon/components/frost-table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

import computed, {readOnly} from 'ember-computed-decorators'
import {Component} from 'ember-frost-core'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import TableMixin from '../mixins/table'
import layout from '../templates/components/frost-table-body'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

export default Component.extend(TableMixin, {
// == Dependencies ==========================================================
Expand Down
3 changes: 1 addition & 2 deletions addon/components/frost-table-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
*/

import {Component} from 'ember-frost-core'
import layout from '../templates/components/frost-table-cell'
import {ItemPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import layout from '../templates/components/frost-table-cell'

export default Component.extend({
// == Dependencies ==========================================================

Expand Down
3 changes: 1 addition & 2 deletions addon/components/frost-table-row-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ const {ViewUtils} = Ember
const {isSimpleClick} = ViewUtils

import {Component} from 'ember-frost-core'
import layout from '../templates/components/frost-table-row-selection'
import {ItemPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import layout from '../templates/components/frost-table-row-selection'

export default Component.extend({

// == Dependencies ==========================================================
Expand Down
5 changes: 2 additions & 3 deletions addon/components/frost-table-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ const {ViewUtils, isEmpty} = Ember
const {isSimpleClick} = ViewUtils
import computed, {readOnly} from 'ember-computed-decorators'
import {Component} from 'ember-frost-core'
import {ColumnPropType, ItemPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import TableMixin, {ROW_SELECTION_CLASS} from '../mixins/table'
import layout from '../templates/components/frost-table-row'
import {ColumnPropType, ItemPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

export default Component.extend(TableMixin, {
// == Dependencies ==========================================================
Expand Down
5 changes: 2 additions & 3 deletions addon/components/frost-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import computed, {readOnly} from 'ember-computed-decorators'
import {Component} from 'ember-frost-core'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

import SelectionMixin from '../mixins/selection'
import TableMixin from '../mixins/table'
import layout from '../templates/components/frost-table'
import {ItemsPropType} from 'ember-frost-table/typedefs'
import {PropTypes} from 'ember-prop-types'

export default Component.extend(SelectionMixin, TableMixin, {
// == Dependencies ==========================================================
Expand Down
3 changes: 2 additions & 1 deletion addon/typedefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {PropTypes} from 'ember-prop-types'
* @property {Number} [index] - the column index of this column. Added by the table components.
* @property {String} label - the column header label
* @property {String} propertyName - the name of the property in the data record to display in this column
* @property {Boolean} [frozen=false] - true if this column should be frozen (on either the left or right side of the table)
* @property {Boolean} [frozen=false] - true if this column should be frozen (on either the left or right
* side of the table)
* @property {Component} [renderer] - the cell renderer to use for all data cells in this column
* @property {String} [category] - the category the column belongs to
* @property {String} [categoryClassName] - the css class name of the category the column belongs to
Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "ember-frost-table",
"dependencies": {
"ember-mocha-adapter": "~0.3.1",
"perfect-scrollbar": ">=0.6.7 <2.0.0"
}
}
2 changes: 1 addition & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')

module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
let app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"broccoli-asset-rev": "^2.4.5",
"chai-jquery": "^2.0.0",
"ember-cli": "2.12.3",
"ember-cli-chai": "^0.3.2",
"ember-cli-chai": "0.4.3",
"ember-cli-code-coverage": "0.3.5",
"ember-cli-frost-blueprints": "^1.2.1",
"ember-cli-htmlbars-inline-precompile": "0.3.12",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-mirage": "0.3.3",
"ember-cli-mocha": "^0.13.0",
"ember-cli-mocha": "0.14.4",
"ember-cli-shims": "^1.0.2",
"ember-cli-uglify": "^1.2.0",
"ember-code-snippet": "1.8.0",
Expand All @@ -41,21 +41,22 @@
"ember-export-application-global": "^1.0.5",
"ember-frost-core": "1.23.10",
"ember-frost-notifier": "3.0.0",
"ember-hook": "^1.4.1",
"ember-frost-test": "^2.1.2",
"ember-hook": "^1.4.2",
"ember-inflector": "^1.9.4",
"ember-load-initializers": "^0.6.0",
"ember-lodash-shim": "1.0.1",
"ember-perfectscroll": "0.1.12",
"ember-prop-types": "^3.14.1",
"ember-resolver": "^2.0.3",
"ember-sinon": "^0.6.0",
"ember-spread": "^1.2.2",
"ember-source": "~2.12.0",
"ember-test-utils": "^5.1.1",
"ember-spread": "^1.2.2",
"ember-test-utils": "^6.0.0",
"ember-truth-helpers": "^1.2.0",
"loader.js": "^4.2.3",
"lodash-es": "4.15.0",
"sinon-chai": "^2.8.0"
"sinon-chai": "^2.14.0"
},
"dependencies": {
"ember-cli-babel": "^5.1.7",
Expand All @@ -72,4 +73,4 @@
"pr-bumper": {
"coverage": 97.45
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* Component definition for the text-input-renderer component
*/
import {CellRenderer} from 'ember-frost-table'

import layout from './template'
import {CellRenderer} from 'ember-frost-table'

// BEGIN-SNIPPET multi-line-renderer
export default CellRenderer.extend({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* Component definition for the text-input-renderer component
*/
import {CellRenderer} from 'ember-frost-table'

import layout from './template'
import {CellRenderer} from 'ember-frost-table'

// BEGIN-SNIPPET text-input-renderer
export default CellRenderer.extend({
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */

module.exports = function (environment) {
var ENV = {
let ENV = {
modulePrefix: 'dummy',
podModulePrefix: 'dummy/pods',
environment: environment,
Expand Down
17 changes: 11 additions & 6 deletions tests/integration/components/frost-fixed-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ import sinon from 'sinon'

import {fixedColumns, fixedColumnsWithCustomRenderers, heroes} from './data'
import {startMirage, stopMirage} from 'dummy/tests/helpers/mirage'
import {assertRowsSelected, rowBodyRangeSelect, rowBodySingleSelect, rowCheckboxRangeSelect,
rowCheckboxSingleSelect} from 'dummy/tests/helpers/selection'
import {
assertRowsSelected,
rowBodyRangeSelect,
rowBodySingleSelect,
rowCheckboxRangeSelect,
rowCheckboxSingleSelect
} from 'dummy/tests/helpers/selection'

const test = integration('frost-fixed-table')
describe(test.label, function () {
Expand Down Expand Up @@ -556,7 +561,7 @@ describe(test.label, function () {
})

describe('the header', function () {
const headerRow = -1 // differentiates from data row 0
const headerRow = -1 // differentiates from data row 0

describe('the left section', function () {
describe('when an event is triggered by a renderer', function () {
Expand All @@ -577,7 +582,7 @@ describe(test.label, function () {
describe('the middle section', function () {
const middleColumns = fixedColumnsWithCustomRenderers.slice(1, 3)
middleColumns.forEach((column, index) => {
const globalIndex = index + 1 // offset by single left column
const globalIndex = index + 1 // offset by single left column
describe(`when the renderer for column ${globalIndex} triggers an event`, function () {
beforeEach(function () {
// FIXME: Fix this to use qualifiers on '...renderer-input' hook
Expand Down Expand Up @@ -637,7 +642,7 @@ describe(test.label, function () {

heroes.forEach((hero, rowIndex) => {
middleColumns.forEach((column, index) => {
const globalIndex = index + 1 // left column count offsets all of our hooks + events
const globalIndex = index + 1 // left column count offsets all of our hooks + events
describe(`when an event is triggered from the cell in row: ${rowIndex}, column: ${index}`, function () {
beforeEach(function () {
// FIXME: Fix this to use qualifiers on '...renderer-input' hook
Expand All @@ -660,7 +665,7 @@ describe(test.label, function () {

heroes.forEach((hero, rowIndex) => {
rightColumns.forEach((column, index) => {
const globalIndex = index + 3 // left + right column count offsets all of our hooks + events
const globalIndex = index + 3 // left + right column count offsets all of our hooks + events
describe(`when an event is triggered from the cell in row: ${rowIndex}, column: ${index}`, function () {
beforeEach(function () {
// FIXME: Fix this to use qualifiers on '...renderer-input' hook
Expand Down
35 changes: 20 additions & 15 deletions tests/integration/components/frost-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ import sinon from 'sinon'

import {columns, columnsWithCustomRenderers, heroes} from './data'
import {startMirage, stopMirage} from 'dummy/tests/helpers/mirage'
import {assertRowsSelected, rowBodyRangeSelect, rowBodySingleSelect, rowCheckboxRangeSelect,
rowCheckboxSingleSelect} from 'dummy/tests/helpers/selection'
import {
assertRowsSelected,
rowBodyRangeSelect,
rowBodySingleSelect,
rowCheckboxRangeSelect,
rowCheckboxSingleSelect
} from 'dummy/tests/helpers/selection'

const test = integration('frost-table')
describe(test.label, function () {
Expand Down Expand Up @@ -145,19 +150,19 @@ describe(test.label, function () {
return wait()
})

it('rows should have "selectable" class', function () {
it('should have "selectable" class on rows', function () {
expect(this.$('.frost-table-row')).to.have.class('selectable')
})

it('no row has "is-selected" class', function () {
it('should not have "is-selected" class on row', function () {
expect(this.$('.frost-table-row')).to.not.have.class('is-selected')
})

it('first column has selection checkboxes', function () {
it('should have selection checkboxes on first column', function () {
expect($hook('myTable-body-row-selectionCell')).to.have.length(heroes.length)
})

it('header should have clear selection cell', function () {
it('should have clear selection cell on header', function () {
expect($hook('myTable-header-selectionCell')).to.have.length(1)
})

Expand All @@ -167,7 +172,7 @@ describe(test.label, function () {
return wait()
})

it('first row is in selected state', function () {
it('should have first row in selected state', function () {
assertRowsSelected('myTable-body-row', 0)
})
})
Expand All @@ -178,7 +183,7 @@ describe(test.label, function () {
return wait()
})

it('first row is in selected state', function () {
it('should have first row in selected state', function () {
assertRowsSelected('myTable-body-row', 0)
})
})
Expand All @@ -189,7 +194,7 @@ describe(test.label, function () {
return wait()
})

it('first 5 rows are in selected state', function () {
it('should have first 5 rows in selected state', function () {
assertRowsSelected('myTable-body-row', 0, 1, 2, 3, 4)
})
})
Expand All @@ -200,7 +205,7 @@ describe(test.label, function () {
return wait()
})

it('first 5 rows are in selected state', function () {
it('should have first 5 rows in selected state', function () {
assertRowsSelected('myTable-body-row', 0, 1, 2, 3, 4)
})
})
Expand All @@ -212,7 +217,7 @@ describe(test.label, function () {
return wait()
})

it('both rows should be in selected state', function () {
it('should have selected state for both rows', function () {
assertRowsSelected('myTable-body-row', 0, 1)
})
})
Expand All @@ -224,7 +229,7 @@ describe(test.label, function () {
return wait()
})

it('only the second row selected should be in selected state', function () {
it('should have only the second row in selected state', function () {
assertRowsSelected('myTable-body-row', 1)
})
})
Expand All @@ -239,7 +244,7 @@ describe(test.label, function () {
})
})

it('no row should be selected', function () {
it('should not have any row be selected', function () {
expect(this.$('.is-selected')).to.have.length(0)
})
})
Expand Down Expand Up @@ -275,7 +280,7 @@ describe(test.label, function () {
})

describe('the header', function () {
const headerRow = -1 // differentiates from data row 0
const headerRow = -1 // differentiates from data row 0

columnsWithCustomRenderers.forEach((column, index) => {
describe(`when the renderer for column ${index} triggers an event`, function () {
Expand All @@ -286,7 +291,7 @@ describe(test.label, function () {
return wait()
})

it('it should be emitted by the table', function () {
it('should be emitted by the table', function () {
expect(onCallback).to.have.been.calledWith(_action({row: headerRow, col: index}))
})
})
Expand Down

0 comments on commit aeb5612

Please sign in to comment.