Skip to content
Permalink
Browse files

fix(form builder): fix float inputs

  • Loading branch information...
anehx authored and czosel committed Jun 13, 2019
1 parent c46b7ad commit 6c111e5f0bc9ba2719cf57486b9989cbb2601d71
@@ -0,0 +1,5 @@
import RenderComponent from "ember-validated-form/components/validated-input/-themes/uikit/render";

export default RenderComponent.extend({
inputComponent: "cfb-float-input/input"
});
@@ -0,0 +1,12 @@
import InputComponent from "ember-validated-form/components/validated-input/types/-themes/uikit/input";

export default InputComponent.extend({
init() {
this._super(...arguments);

this.set("type", "number");
},

attributeBindings: ["step"],
step: "any"
});
@@ -132,17 +132,17 @@
<div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
<div>
{{f.input
type="number"
name="floatMinValue"
label=(t "caluma.form-builder.question.min-value")
renderComponent=(component "cfb-float-input")
}}
</div>

<div>
{{f.input
type="number"
name="floatMaxValue"
label=(t "caluma.form-builder.question.max-value")
renderComponent=(component "cfb-float-input")
}}
</div>
</div>
@@ -0,0 +1 @@
export { default } from "ember-caluma/components/cfb-float-input";
@@ -0,0 +1 @@
export { default } from "ember-caluma/components/cfb-float-input/input";
@@ -0,0 +1,18 @@
import { module, test } from "qunit";
import { setupRenderingTest } from "ember-qunit";
import { render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";

module("Integration | Component | cfb-float-input", function(hooks) {
setupRenderingTest(hooks);

test("it renders", async function(assert) {
assert.expect(1);

await render(
hbs`{{cfb-float-input name="test" update=(action (mut value))}}`
);

assert.dom("input[name=test]").exists();
});
});
@@ -0,0 +1,18 @@
import { module, test } from "qunit";
import { setupRenderingTest } from "ember-qunit";
import { render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";

module("Integration | Component | cfb-float-input/input", function(hooks) {
setupRenderingTest(hooks);

test("it renders", async function(assert) {
assert.expect(3);

await render(hbs`{{cfb-float-input/input name="test"}}`);

assert.dom("input[name=test]").exists();
assert.dom("input[name=test]").hasAttribute("type", "number");
assert.dom("input[name=test]").hasAttribute("step", "any");
});
});

0 comments on commit 6c111e5

Please sign in to comment.
You can’t perform that action at this time.