Skip to content

Commit 51147fa

Browse files
committed
Clean up unnecessarily verbose code
1 parent 45b2087 commit 51147fa

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

src/fields/core/fieldRadios.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
}
2424
},
2525
id() {
26-
return `${this.getFieldID(this.schema, true)}`;
26+
return this.getFieldID(this.schema, true);
2727
}
2828
},
2929

test/unit/specs/fields/fieldRadios.spec.js

+12-24
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,13 @@ describe("FieldRadios.vue", () => {
130130
expect(radios.is(`input[name="${nameAttribute}"]`));
131131
});
132132
it("should render different 'name' attribute for all input[type=radio] across different instances", () => {
133-
const wrapper2 = mount(FieldRadios, {
134-
localVue,
135-
propsData: { schema, model, disabled: false }
136-
});
137-
const radios2 = wrapper2.findAll("input[type=radio]");
138-
139133
const nameAttribute = radios.at(0).attributes().name;
140134
expect(radios.is(`input[name="${nameAttribute}"]`));
141135

142-
const nameAttribute2 = radios2.at(0).attributes().name;
143-
expect(radios2.is(`input[name="${nameAttribute2}"]`));
136+
createField2({ schema, model, disabled: false });
137+
138+
const nameAttribute2 = radios.at(0).attributes().name;
139+
expect(radios.is(`input[name="${nameAttribute2}"]`));
144140

145141
expect(nameAttribute).not.to.equal(nameAttribute2);
146142
});
@@ -250,17 +246,13 @@ describe("FieldRadios.vue", () => {
250246
expect(radios.is(`input[name="${nameAttribute}"]`));
251247
});
252248
it("should render different 'name' attribute for all input[type=radio] across different instances", () => {
253-
const wrapper2 = mount(FieldRadios, {
254-
localVue,
255-
propsData: { schema, model, disabled: false }
256-
});
257-
const radios2 = wrapper2.findAll("input[type=radio]");
258-
259249
const nameAttribute = radios.at(0).attributes().name;
260250
expect(radios.is(`input[name="${nameAttribute}"]`));
261251

262-
const nameAttribute2 = radios2.at(0).attributes().name;
263-
expect(radios2.is(`input[name="${nameAttribute2}"]`));
252+
createField2({ schema, model, disabled: false });
253+
254+
const nameAttribute2 = radios.at(0).attributes().name;
255+
expect(radios.is(`input[name="${nameAttribute2}"]`));
264256

265257
expect(nameAttribute).not.to.equal(nameAttribute2);
266258
});
@@ -374,17 +366,13 @@ describe("FieldRadios.vue", () => {
374366
expect(radios.is(`input[name="${nameAttribute}"]`));
375367
});
376368
it("should render different 'name' attribute for all input[type=radio] across different instances", () => {
377-
const wrapper2 = mount(FieldRadios, {
378-
localVue,
379-
propsData: { schema, model, disabled: false }
380-
});
381-
const radios2 = wrapper2.findAll("input[type=radio]");
382-
383369
const nameAttribute = radios.at(0).attributes().name;
384370
expect(radios.is(`input[name="${nameAttribute}"]`));
385371

386-
const nameAttribute2 = radios2.at(0).attributes().name;
387-
expect(radios2.is(`input[name="${nameAttribute2}"]`));
372+
createField2({ schema, model, disabled: false });
373+
374+
const nameAttribute2 = radios.at(0).attributes().name;
375+
expect(radios.is(`input[name="${nameAttribute2}"]`));
388376

389377
expect(nameAttribute).not.to.equal(nameAttribute2);
390378
});

0 commit comments

Comments
 (0)