Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Commit

Permalink
remove jquery from content-edition-test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentcapicotto committed Aug 12, 2021
1 parent ed431d3 commit 853daca
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/integration/components/content-edition-test.js
Expand Up @@ -44,14 +44,14 @@ module('Integration | Component | content edition', function (hooks) {

await customHelpers.clickOnDatatableValueCell(1, 1)

assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.equal(this.$('input').get(0).value, 'Row 0', 'Editor has the correct content')
assert.dom('input').exists({ count: 1 }, 'Editor is displayed')
assert.dom('input').hasValue('Row 0', 'Editor has the correct content')

await customHelpers.typeInDatatable('This is my row')
await customHelpers.pressEnterInDatatable()
await customHelpers.clickOnDatatableColumnCell(1)

assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.dom('input').exists({ count: 1 }, 'Editor is displayed')

assert.deepEqual(
customHelpers.getDatatableContent(),
Expand Down Expand Up @@ -176,7 +176,7 @@ module('Integration | Component | content edition', function (hooks) {
await customHelpers.clickOnDatatableValueCell(1, 1)
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 0, 'Editor is not displayed')
assert.dom('input').doesNotExist('Editor is not displayed')

assert.deepEqual(
customHelpers.getDatatableContent(),
Expand All @@ -198,10 +198,10 @@ module('Integration | Component | content edition', function (hooks) {
await render(hbs`{{easy-datatable table=table}}`)

await customHelpers.clickOnDatatableValueCell(1, 1)
assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.dom('input').exists('Editor is displayed')

await customHelpers.clickOnDatatableValueCell(3, 3)
assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.dom('input').exists('Editor is displayed')
})

test('Navigate, press enter and edit', async function (assert) {
Expand All @@ -227,12 +227,12 @@ module('Integration | Component | content edition', function (hooks) {
await customHelpers.pressDownKeyInDatatable()
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.dom('input').exists({ count: 1 }, 'Editor is displayed')

await customHelpers.typeInDatatable('My new value')
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 0, 'Editor is not displayed')
assert.dom('input').doesNotExist('Editor is not displayed')
assert.deepEqual(
customHelpers.getDatatableContent(),
[
Expand Down Expand Up @@ -265,11 +265,11 @@ module('Integration | Component | content edition', function (hooks) {
await customHelpers.pressEscInDatatable()
await customHelpers.typeInDatatable('I type something without having an input')

assert.ok(this.$('input').length === 1, 'Editor is displayed')
assert.dom('input').exists({ count: 1 }, 'Editor is displayed')

await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 0, 'Editor is not displayed')
assert.dom('input').doesNotExist('Editor is not displayed')

assert.deepEqual(
customHelpers.getDatatableContent(),
Expand All @@ -295,33 +295,33 @@ module('Integration | Component | content edition', function (hooks) {

await customHelpers.clickOnDatatableColumnCell(1)

assert.ok(this.$('input').length === 0, 'When clicking on the protected cell, the editor does not show up')
assert.dom('input').doesNotExist('When clicking on the protected cell, the editor does not show up')

await customHelpers.clickOnDatatableColumnCell(2)

assert.ok(this.$('input').length === 1, 'but it still work on an editable cell')
assert.dom('input').exists({ count: 1 }, 'but it still work on an editable cell')

await customHelpers.pressEscInDatatable()
await customHelpers.pressDownKeyInDatatable()
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 0, 'When pressing enter in a protected cell, we do not get the editor')
assert.dom('input').doesNotExist('When pressing enter in a protected cell, we do not get the editor')

await customHelpers.pressDownKeyInDatatable()
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 1, 'but it still works in editable cells')
assert.dom('input').exists({ count: 1 }, 'but it still works in editable cells')

await customHelpers.pressEscInDatatable()
await customHelpers.pressLeftKeyInDatatable()
await customHelpers.pressEnterInDatatable()

assert.ok(this.$('input').length === 0, 'Same principle when typing in a protected cell')
assert.dom('input').doesNotExist('Same principle when typing in a protected cell')

await customHelpers.pressDownKeyInDatatable()
await customHelpers.typeInDatatable('Ho')

assert.ok(this.$('input').length === 1, 'but it still works in editable cells')
assert.dom('input').exists({ count: 1 }, 'but it still works in editable cells')

await customHelpers.pressEscInDatatable()
})
Expand Down

0 comments on commit 853daca

Please sign in to comment.