Skip to content

Commit cc1c17a

Browse files
committed
fixed a bug where the same baseUrl could appear in the autocomplete more than once
1 parent 7c5f31c commit cc1c17a

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

packages/selenium-ide/src/neo/__test__/stores/domain/ProjectStore.spec.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe("Project Store", () => {
167167
const projectRep = {
168168
id: "1",
169169
name: "my project",
170-
url: "https://en.wikipedia.org",
170+
url: "https://en.wikipedia.org/",
171171
tests: [
172172
{
173173
id: "1",
@@ -203,8 +203,8 @@ describe("Project Store", () => {
203203
}
204204
],
205205
urls: [
206-
"https://en.wikipedia.org",
207-
"http://www.seleniumhq.org"
206+
"https://en.wikipedia.org/",
207+
"http://www.seleniumhq.org/"
208208
].sort(),
209209
plugins: [
210210
{
@@ -242,6 +242,19 @@ describe("Project Store", () => {
242242
project.fromJS(projectRep);
243243
expect(project.id).toBeDefined();
244244
});
245+
it("should remove duplicate urls when loaded", () => {
246+
const projectRep = {
247+
name: "my project",
248+
url: "",
249+
tests: [],
250+
suites: [],
251+
urls: ["https://seleniumhq.org/", "https://seleniumhq.org/"]
252+
};
253+
254+
const project = new ProjectStore();
255+
project.fromJS(projectRep);
256+
expect(project.urls.length).toBe(1);
257+
});
245258
it("should have a list of loaded plugins", () => {
246259
const project = new ProjectStore();
247260
expect(project.plugins).toBeDefined();

packages/selenium-ide/src/neo/stores/domain/ProjectStore.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ export default class ProjectStore {
140140
this.setUrl(jsRep.url);
141141
this._tests.replace(jsRep.tests.map(TestCase.fromJS));
142142
this._suites.replace(jsRep.suites.map((suite) => Suite.fromJS(suite, this.tests)));
143-
this._urls.replace(jsRep.urls);
143+
this._urls.clear();
144+
jsRep.urls.forEach((url) => {
145+
this.addUrl(url);
146+
});
144147
this.plugins.replace(jsRep.plugins);
145148
this.id = jsRep.id || uuidv4();
146149
this.setModified(false);

0 commit comments

Comments
 (0)