refactor: 💡 convert form input to nested structure
This commit is contained in:
9 files changed
+28
-29
No files matched your search
@@ -1,11 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/form/input';
|
||||
import ComponentAutoId from '../../../mixins/component-auto-id';
|
||||
|
||||
/**
|
||||
* A simple HTML `<input>` element.
|
||||
*/
|
||||
export default Component.extend(ComponentAutoId, {
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
File renamed without changes.
@@ -0,0 +1,10 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { generateComponentID } from '../../../../utilities/component-auto-id';
|
||||
|
||||
export default class RoseFormInputComponent extends Component {
|
||||
|
||||
// =attributes
|
||||
|
||||
id = generateComponentID();
|
||||
|
||||
}
|
||||
File renamed without changes.
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/form/input/input';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
import { v1 } from 'ember-uuid';
|
||||
|
||||
/**
|
||||
* A function that generates a component ID, based on UUID.
|
||||
* @return {string}
|
||||
*/
|
||||
export function generateComponentID() {
|
||||
return `component-${v1()}`;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import EmberObject from '@ember/object';
|
||||
import ComponentAutoIdMixin from 'rose/mixins/component-auto-id';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Mixin | component-auto-id', function () {
|
||||
test('it generates an ID and assigns it to the object', function (assert) {
|
||||
let ComponentAutoIdObject = EmberObject.extend(ComponentAutoIdMixin);
|
||||
let subject = ComponentAutoIdObject.create();
|
||||
assert.ok(subject.id);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { generateComponentID } from 'rose/utilities/component-auto-id';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Utility | component-auto-id', function () {
|
||||
test('it generates an ID', function (assert) {
|
||||
const id = generateComponentID();
|
||||
assert.ok(id);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user