Add lexicon entries

This commit is contained in:
Leonard Smith 2020-10-07 11:34:11 -05:00
parent 4176cda0c2
commit df78624d04
5 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<h4>Lexicon Entry</h4>
<p>{{this.currentWordEntry.id}}</p>

View File

@ -0,0 +1,13 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class LexiconEntryComponent extends Component {
@service('word-select') selectedWord;
get
currentWordEntry() {
let word = this.selectedWord.current();
console.log(word);
return word.lexicalEntry;
}
}

View File

@ -0,0 +1,8 @@
import Model, { attr, hasMany } from '@ember-data/model';
export default class LexicalEntryModel extends Model {
@attr lemma;
@attr commentary;
@hasMany('word') word;
}

View File

@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | lexicon/entry', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<Lexicon::Entry />`);
assert.equal(this.element.textContent.trim(), '');
// Template block usage:
await render(hbs`
<Lexicon::Entry>
template block text
</Lexicon::Entry>
`);
assert.equal(this.element.textContent.trim(), 'template block text');
});
});

View File

@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Model | lexical entry', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('lexical-entry', {});
assert.ok(model);
});
});