forked from WycliffeAssociates/en_btr_frontend
Add lexicon entries
This commit is contained in:
parent
4176cda0c2
commit
df78624d04
|
@ -0,0 +1,2 @@
|
||||||
|
<h4>Lexicon Entry</h4>
|
||||||
|
<p>{{this.currentWordEntry.id}}</p>
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue