diff --git a/app/components/lexicon/entry.hbs b/app/components/lexicon/entry.hbs new file mode 100644 index 0000000..2aaa8a9 --- /dev/null +++ b/app/components/lexicon/entry.hbs @@ -0,0 +1,2 @@ +

Lexicon Entry

+

{{this.currentWordEntry.id}}

diff --git a/app/components/lexicon/entry.js b/app/components/lexicon/entry.js new file mode 100644 index 0000000..c42d234 --- /dev/null +++ b/app/components/lexicon/entry.js @@ -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; + } +} diff --git a/app/models/lexical-entry.js b/app/models/lexical-entry.js new file mode 100644 index 0000000..6c3e0f5 --- /dev/null +++ b/app/models/lexical-entry.js @@ -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; +} diff --git a/tests/integration/components/lexicon/entry-test.js b/tests/integration/components/lexicon/entry-test.js new file mode 100644 index 0000000..e792203 --- /dev/null +++ b/tests/integration/components/lexicon/entry-test.js @@ -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``); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/models/lexical-entry-test.js b/tests/unit/models/lexical-entry-test.js new file mode 100644 index 0000000..7efeba9 --- /dev/null +++ b/tests/unit/models/lexical-entry-test.js @@ -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); + }); +});