Skip to content

Commit d879919

Browse files
committed
correct path generation
1 parent 0eef5e5 commit d879919

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/router/contexts/route-path-addendum.context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class UmbRoutePathAddendumContext
3434
if (this.#parentAddendum === undefined || this.#currentAddendum === undefined) {
3535
return;
3636
}
37-
this.#pathAddendum.setValue(this.#parentAddendum + this.#currentAddendum);
37+
const base = this.#parentAddendum === '' ? this.#parentAddendum : this.#parentAddendum + '/';
38+
this.#pathAddendum.setValue(base + this.#currentAddendum);
3839
}
3940
}

src/Umbraco.Web.UI.Client/src/packages/core/router/contexts/route-path-addendum.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ describe('UmbRoutepathAddendum', () => {
6060
it('returns late set addendum', (done) => {
6161
addendumContext.observe(addendumContext.addendum, (addendum) => {
6262
if (addendum) {
63-
expect(addendum).to.equal('/hello/here');
63+
expect(addendum).to.equal('hello/here');
6464
done();
6565
}
6666
});
67-
addendumContext.setAddendum('/hello/here');
67+
addendumContext.setAddendum('hello/here');
6868
});
6969

7070
it('returns an updated addendum', (done) => {
@@ -73,49 +73,49 @@ describe('UmbRoutepathAddendum', () => {
7373
count++;
7474
if (count === 1) {
7575
if (addendum) {
76-
expect(addendum).to.equal('/hello/here');
76+
expect(addendum).to.equal('hello/here');
7777
done();
7878
}
7979
} else if (count === 2) {
8080
if (addendum) {
81-
expect(addendum).to.equal('/hello/updateded');
81+
expect(addendum).to.equal('hello/updateded');
8282
done();
8383
}
8484
}
8585
});
86-
addendumContext.setAddendum('/hello/here');
87-
addendumContext.setAddendum('/hello/updateded');
86+
addendumContext.setAddendum('hello/here');
87+
addendumContext.setAddendum('hello/updateded');
8888
});
8989

9090
it('returns early set child addendum', (done) => {
91-
addendumContext.setAddendum('/hello/here');
91+
addendumContext.setAddendum('hello/here');
9292
const innerChild = new UmbTestChildElement();
9393
child.appendChild(innerChild);
9494
const childAddendumContext = new UmbRoutePathAddendumContext(innerChild);
95-
childAddendumContext.setAddendum('/child-specification');
95+
childAddendumContext.setAddendum('child-specification');
9696

9797
childAddendumContext.observe(childAddendumContext.addendum, (addendum) => {
9898
if (addendum) {
99-
expect(addendum).to.equal('/hello/here/child-specification');
99+
expect(addendum).to.equal('hello/here/child-specification');
100100
done();
101101
}
102102
});
103103
});
104104

105105
it('returns late set child addendum', (done) => {
106-
addendumContext.setAddendum('/hello/here');
106+
addendumContext.setAddendum('hello/here');
107107
const innerChild = new UmbTestChildElement();
108108
child.appendChild(innerChild);
109109
const childAddendumContext = new UmbRoutePathAddendumContext(innerChild);
110110

111111
childAddendumContext.observe(childAddendumContext.addendum, (addendum) => {
112112
if (addendum) {
113-
expect(addendum).to.equal('/hello/here/child-specification');
113+
expect(addendum).to.equal('hello/here/child-specification');
114114
done();
115115
}
116116
});
117117

118-
childAddendumContext.setAddendum('/child-specification');
118+
childAddendumContext.setAddendum('child-specification');
119119
});
120120
});
121121
});

0 commit comments

Comments
 (0)