Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add "Testing" section #717

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions addon-test-support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TablePage from './pages/ember-table';

export { TablePage };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"devDependencies": {
"@addepar/ember-toolbox": "^0.3.2",
"@addepar/eslint-config": "^4.0.0",
"@addepar/eslint-config": "^4.0.2",
"@addepar/prettier-config": "^1.0.0",
"@addepar/sass-lint-config": "^2.0.1",
"@addepar/style-toolbox": "~0.7.0",
Expand Down
5 changes: 5 additions & 0 deletions tests/dummy/app/pods/docs/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
{{nav.item 'Rows and Trees' 'docs.guides.body.rows-and-trees'}}
{{nav.item 'Row Selection' 'docs.guides.body.row-selection'}}
{{nav.item 'Occlusion' 'docs.guides.body.occlusion'}}

{{nav.section 'Testing'}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this on the live site? Or tests/dummy/ is only content for test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what generates the "Testing" section in the addon docs. (The tests/dummy app is the addon docs.)


{{nav.item 'Table Test Page' 'docs.testing.test-page'}}

{{/viewer.nav}}

{{#viewer.main}}
Expand Down
29 changes: 29 additions & 0 deletions tests/dummy/app/pods/docs/testing/test-page/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Testing Ember Table

## Table Page Object

Ember Table includes a test helper that you can import in your app's acceptance tests and use to interact with a table on the page. The Page helper is based on [`ember-classy-page-object`](https://github.com/pzuraq/ember-classy-page-object).

To import it:

```js
import { TablePage } from 'ember-table/test-support';
```

Usage:

```js
// ... in an acceptance test:
const table = new TablePage();

assert.equal(table.body.rowCount, 5, 'the table has 5 body rows');
assert.equal(table.header.rows.length, 1, 'the table has 1 row of headers');
assert.equal(table.footer.rows.length, 1, 'the table has 1 row of footers');

await table.selectRow(0); // The first body row is selected
assert.ok(table.body.rows.objectAt(0).isSelected, 'first row is selected');
assert.ok(!table.body.rows.objectAt(1).isSelected, 'second row is not selected');
```

To learn more about the properties that are present on the table page object, refer to [its source](https://github.com/Addepar/ember-table/blob/master/addon-test-support/pages/ember-table.js) or
to [its usage in the ember-table tests](https://github.com/Addepar/ember-table/blob/master/tests/integration/components/basic-test.js).
4 changes: 4 additions & 0 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Router.map(function() {
});
});

this.route('testing', function() {
this.route('test-page');
});

this.route('api', function() {
this.route('class', { path: '/:class_id' });
});
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
sass-lint "^1.12.1"
walk-sync "^0.3.2"

"@addepar/eslint-config@^4.0.0":
version "4.0.1"
resolved "https://registry.npmjs.org/@addepar/eslint-config/-/eslint-config-4.0.1.tgz#6f131ee27d894225308a7059404a877f9f4fb596"
integrity sha512-H8EzoOfr+TqGSgEiq7yB2T18Tw7Y0pH31/X1Qv9QK13+jdKWEUCWot1rkATk2x6ILsBU3lMUYdxke9xfGj9kbA==
"@addepar/eslint-config@^4.0.2":
version "4.0.2"
resolved "https://registry.npmjs.org/@addepar/eslint-config/-/eslint-config-4.0.2.tgz#312ac71dfa0123ef387342e5b71911019b878862"
integrity sha512-DXmIbhd7jlImQAUU++gVCplZEXUM5Hxrdeen+u3CdR8d1AncE7+P9W9OTQS7HnYkVxyZzky+YURtPk3LUaBcvg==
dependencies:
eslint-config-prettier "^2.9.0"
eslint-plugin-ember "^5.0.1"
Expand Down