Skip to content

Commit

Permalink
feat(client): display ship speed
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlatz committed Feb 25, 2024
1 parent 5895675 commit 1214b6e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/app/models/ship.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Model, { attr } from '@ember-data/model';

export default class ShipModel extends Model {
@attr name;
@attr speedInKilometersPerSecond;
@attr currentPosition;
@attr currentLocation;
@attr destinationPosition;
Expand Down
5 changes: 5 additions & 0 deletions client/app/templates/ships/get.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<h2>{{@model.name}}</h2>

<dl>
<dt id="speed">Speed</dt>
<dd aria-labelledby="speed">
{{@model.speedInKilometersPerSecond}} km/s
</dd>

<dt id="current-location">Current location</dt>
<dd aria-labelledby="current-location">
<Position @position={{@model.currentPosition}} />
Expand Down
3 changes: 3 additions & 0 deletions client/mirage/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function routes() {
type: 'ship',
attributes: {
name: 'Artémis',
speedInKilometersPerSecond: 100,
currentPosition: { x: 3, y: 3 },
currentLocation: { name: 'Moon' },
destinationPosition: null,
Expand All @@ -41,6 +42,7 @@ function routes() {
type: 'ship',
attributes: {
name: 'Bebop',
speedInKilometersPerSecond: 100,
currentPosition: { x: 1, y: 1 },
currentLocation: { name: 'Earth' },
destinationPosition: null,
Expand All @@ -58,6 +60,7 @@ function routes() {
type: 'ship',
attributes: {
name: 'Artémis',
speedInKilometersPerSecond: 100,
currentPosition: { x: 3, y: 3 },
currentLocation: { name: 'Moon' },
destinationPosition: null,
Expand Down
3 changes: 3 additions & 0 deletions client/tests/acceptance/sokown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ module('Acceptance | sokown', function (hooks) {
assert
.dom(screen.getByRole('heading', { name: 'Artémis', level: 2 }))
.exists();
assert
.dom(screen.getByRole('definition', { name: 'Speed' }))
.hasText('100 km/s');
assert
.dom(screen.getByRole('definition', { name: 'Current location' }))
.hasText('3 3 Moon');
Expand Down

0 comments on commit 1214b6e

Please sign in to comment.