-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement: add missing "autocomplete", "placeholder" and "readonly"… #63
Conversation
… attr to input fields. Ordered alphabetically.
1 similar comment
@@ -1,5 +1,5 @@ | |||
<template lang="jade"> | |||
input.form-control(type="number", v-model="value", number, :min="schema.min", :max="schema.max", :readonly="schema.readonly", :disabled="disabled", :placeholder="schema.placeholder") | |||
input.form-control(type="number", v-model="value", number, :autocomplete="schema.autocomplete", :disabled="disabled", :max="schema.max", :min="schema.min", :readonly="schema.readonly") | |||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed the placeholder from here?
Please add tests to the new attributes like |
1 similar comment
I had a little bit of hard time (dead computer 💀 ), but I was able to simplify the test for attributes to this: import { createVueField, trigger, /*new thing in util.js --> */ attributesList } from "../util";
// other tests...
describe.only("check optional attribute", () => {
// here you name which attribute you want to test and that's it.
let attributes = ["autocomplete", "disabled"];
attributes.forEach(function(name) {
it('should set ' + name, function(done) {
let schematic;
let attr = attributesList[name];
if (attr.field) {
schematic = field;
} else {
schematic = schema;
}
schematic[name] = attr.before;
vm.$nextTick(() => {
expect(input[name]).to.be.equal(schematic[name]);
schematic[name] = attr.after;
done();
});
});
});
}); // util.js
export let attributesList = {
"autocomplete": { before: "on", after: "off" },
"disabled": { before: true, after: false, field: true },
"placeholder": { before: "Field placeholder", after: "" },
"readonly": { before: true, after: false }
// etc...
}; |
My tests fail if the properties are not set in the |
Woops my bad |
Please explain, I don't understand. |
but:
Why ? |
Yes, because first case the "autocomplete" property is not reactive. Use schema.$set("autocomplete", "on") or field.schema.$set("autocomplete", "on") |
I tried it and it trigger other errors. I want to finish it so I'm going to do it by initializing for now. |
expect(input.readOnly).to.be.false; | ||
expect(input.disabled).to.be.false; | ||
// expect(input.placeholder).to.be.equal(schema.placeholder); | ||
// expect(input.readOnly).to.be.false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this old commented rows (other files too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure you wanted to delete them or not, so meanwhile, I commented them. I will clean things now !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are mindful. But if we covered with your new code we can delete them. Because after 3 months, we won't know it is a skipped tests (what need to fix) or unneccessary :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, make sense, sorry about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nop, if you ready, I will merge it. 🎉
So can be merge? (after green travis) |
Add missing "autocomplete", "placeholder" and "readonly" attr to input fields. Ordered alphabetically.