Vue-form-generator: add "autocomplete" attr to input fields

Created on 25 Aug 2016  路  18Comments  路  Source: vue-generators/vue-form-generator

Same as "readonly". Add to every field which contains input element.
Example schema:

        let schema = {
            type: "text",
            label: "E-mail",
            model: "email",
            readonly: false,
            autocomplete: true,
            placeholder: "Field placeholder"
        };

Example template of field:

    input.form-control(type="email", v-model="value", :readonly="schema.readonly", :disabled="disabled", :placeholder="schema.placeholder", :autocomplete="schema.autocomplete")
enhancement easy

Most helpful comment

Yes, I think it is working already, just need to test it.

All 18 comments

I'm doing it
EDIT: Done #63

Great!

I fixed the problems, can you merge now ?

Need test cases too.

Does all of this count toward a new version ? 0.4.1 ?
If yes, could you do a milestone linked to the issue/PR ?
It is easier for me to know what's missing. Thank you.

Ok, I did.

Thank you. #50 and #62 count toward what goal ?
I just want to have an idea of the roadmap for the plugin.

62 is only docs, I linked to #64. #50 added to v0.5.0

Wait, you mean custom fields are working ?

Yes, I think it is working already, just need to test it.

Awesome !

@icebob For the test case, I propose to group attribute checking under "check optional attribute" inside "check template" :

describe("check optional attribute", () => {
    it("should set autocomplete", () =>{
        field.autocomplete = true;
        vm.$nextTick( () => {
            expect(input.autocomplete).to.be.true;
            field.autocomplete = false;
            done();
        });
    });

    it("should set disabled", (done) => {
        field.disabled = true;
        vm.$nextTick( () => {
            expect(input.disabled).to.be.true;  
            field.disabled = false;
            done();
        });
    });

    it("should set placeholder", (done) => {
        field.placeholder = "Placeholder text";
        vm.$nextTick( () => {
            expect(input.placeholder).to.be.equal("Placeholder text");
            field.placeholder = "";
            done();
        });
    });

    it("should set readOnly", (done) => {
        schema.readonly = true;
        vm.$nextTick( () => {
            expect(input.readOnly).to.be.true;  
            schema.readonly = false;
            done();
        });
    });
});

Good idea

You will see in the PR #63 that I did a little more, and created a function checkAttribute in util.js so that we can write:

describe("check optional attribute", () => {
    // name which attributes you want to test and that's it.
    let attributes = ["disabled"];

    attributes.forEach(function(name) {
        it("should set " + name, function(done) {
            checkAttribute(name, vm, input, field, schema, done);
        });
    });
});

I hope we can merge now :sweat_smile:

Good stuff!

You are back ! :D

@icebob What's blocking this milestone ?

Only my free time :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dflock picture dflock  路  5Comments

ndro picture ndro  路  4Comments

pimhooghiemstra picture pimhooghiemstra  路  5Comments

sjordan1975 picture sjordan1975  路  5Comments

afourmeaux picture afourmeaux  路  4Comments