This repository has been archived on 2025-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
stockpile-ember/tests/acceptance/list-items-test.js
2016-11-17 08:18:48 +01:00

47 lines
1.5 KiB
JavaScript

import { test } from 'qunit';
import moduleForAcceptance from 'ember-quickstart/tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | list items');
test('visiting /items', function(assert) {
visit('/items');
andThen(function() {
assert.equal(currentURL(), '/items');
});
});
test('should link to information about the company.', function (assert) {
visit('/items');
click('a:contains("About")');
andThen(function () {
assert.equal(currentURL(), '/about', 'should navigate to about');
});
});
test('should list available rentals.', function (assert) {
visit('/items');
andThen(function() {
assert.equal(find('.listing').length, 3, 'should see 3 listings');
});
});
test('should filter the list of rentals by city.', function (assert) {
visit('/items');
fillIn('.list-filter input', 'urban');
keyEvent('.list-filter input', 'keyup', 69);
andThen(function () {
assert.equal(find('.listing').length, 1, 'should show 1 listing');
assert.equal(find('.listing .name:contains("Urban Living")').length, 1, 'should contain 1 listing with name Urban Living');
});
});
test('should show details for a specific rental', function (assert) {
visit('/items');
click('a:contains("Grand Old Mansion")');
andThen(function() {
assert.equal(currentURL(), '/items/grand-old-mansion', 'should navigate to show route');
assert.equal(find('.show-listing h2').text(), "Grand Old Mansion", 'should list rental title');
assert.equal(find('.description').length, 1, 'should list a description of the property');
});
});