Skip to content

Commit 3241235

Browse files
committed
[rdar://116401230] fix: hierarchy-item-icon
1 parent e4a2fef commit 3241235

File tree

6 files changed

+8
-85
lines changed

6 files changed

+8
-85
lines changed

src/components/DocumentationTopic/Hierarchy.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<HierarchyItem
2222
v-if="rootLink"
2323
:url="rootLink"
24-
:hasSlash="false"
2524
>
2625
{{ $t('documentation.title') }}
2726
</HierarchyItem>

src/components/DocumentationTopic/HierarchyCollapsedItems.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
<template>
1212
<li class="hierarchy-collapsed-items">
13-
<span class="hierarchy-item-icon icon-inline">/</span>
1413
<button
1514
class="toggle"
1615
ref="btn"
@@ -130,14 +129,9 @@ $dropdown-vertical-offset: rem(7px);
130129
align-items: center;
131130
margin-left: $nav-space-hierarchy-elements;
132131
133-
.hierarchy-item-icon {
134-
width: 9px;
135-
height: 15px;
136-
margin-right: $nav-space-hierarchy-elements;
137-
display: flex;
138-
justify-content: center;
139-
font-size: 1em;
140-
align-self: baseline;
132+
&:before{
133+
content: '\00a0/\00a0';
134+
141135
}
142136
143137
@include nav-in-breakpoint() {

src/components/DocumentationTopic/HierarchyItem.vue

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
:class="[{ collapsed: props.isCollapsed }, data.staticClass]"
1515
class="hierarchy-item"
1616
>
17-
<span v-if="props.hasSlash" class="hierarchy-item-icon icon-inline">/</span>
1817
<router-link v-if="props.url" class="parent item nav-menu-link" :to="props.url">
1918
<slot />
2019
</router-link>
@@ -40,10 +39,6 @@ export default {
4039
type: String,
4140
required: false,
4241
},
43-
hasSlash: {
44-
type: Boolean,
45-
default: () => true,
46-
},
4742
},
4843
};
4944
</script>
@@ -52,19 +47,10 @@ export default {
5247
@import 'docc-render/styles/_core.scss';
5348
5449
.hierarchy-item {
55-
// style the chevron icon
56-
:deep(.hierarchy-item-icon) {
57-
width: 9px;
58-
height: 15px;
59-
margin-right: $nav-space-hierarchy-elements;
60-
display: flex;
61-
justify-content: center;
62-
font-size: 1em;
63-
align-self: baseline;
64-
// hide on when collapsed
65-
@include nav-in-breakpoint() {
66-
display: none;
67-
}
50+
// applies " / " at the start of the item when the item is not the first child
51+
&:not(:first-child):before{
52+
content: '\00a0/\00a0';
53+
6854
}
6955
7056
display: flex;

tests/unit/components/DocumentationTopic/Hierarchy.spec.js

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ describe('Hierarchy', () => {
125125
expect(barItem.text()).toBe(bar.title);
126126

127127
const currentItem = items.at(items.length - 1);
128-
expect(currentItem.attributes()).toEqual({
129-
hasslash: 'true',
130-
});
128+
expect(currentItem.attributes()).toEqual({});
131129
expect(currentItem.text()).toBe(baz.title);
132130

133131
expect(wrapper.contains(HierarchyCollapsedItems)).toBe(false);
@@ -205,25 +203,20 @@ describe('Hierarchy', () => {
205203
// next assert the collapsible items. Only one, as 3 can live outside at 1200
206204
expect(items.at(1).attributes()).toEqual({
207205
iscollapsed: 'true',
208-
hasslash: 'true',
209206
url: references[parentTopicIdentifiers[1]].url,
210207
});
211208
// assert the items outside of the collapse
212209
expect(items.at(2).attributes()).toEqual({
213-
hasslash: 'true',
214210
url: references[parentTopicIdentifiers[2]].url,
215211
});
216212
expect(items.at(3).attributes()).toEqual({
217-
hasslash: 'true',
218213
url: references[parentTopicIdentifiers[3]].url,
219214
});
220215
expect(items.at(4).attributes()).toEqual({
221-
hasslash: 'true',
222216
url: references[parentTopicIdentifiers[4]].url,
223217
});
224218
// assert the last item has no attributes
225219
expect(items.at(5).attributes()).toEqual({
226-
hasslash: 'true',
227220
});
228221

229222
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -248,27 +241,22 @@ describe('Hierarchy', () => {
248241

249242
// assert the collapsible items. Two collapsed, as 2 can live outside between 1000 - 1200
250243
expect(items.at(1).attributes()).toEqual({
251-
hasslash: 'true',
252244
iscollapsed: 'true',
253245
url: references[parentTopicIdentifiers[1]].url,
254246
});
255247
expect(items.at(2).attributes()).toEqual({
256-
hasslash: 'true',
257248
iscollapsed: 'true',
258249
url: references[parentTopicIdentifiers[2]].url,
259250
});
260251
// assert the items outside of the collapse
261252
expect(items.at(3).attributes()).toEqual({
262-
hasslash: 'true',
263253
url: references[parentTopicIdentifiers[3]].url,
264254
});
265255
expect(items.at(4).attributes()).toEqual({
266-
hasslash: 'true',
267256
url: references[parentTopicIdentifiers[4]].url,
268257
});
269258
// assert the last item has no attributes
270259
expect(items.at(5).attributes()).toEqual({
271-
hasslash: 'true',
272260
});
273261

274262
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -292,35 +280,29 @@ describe('Hierarchy', () => {
292280
// assert what items are shown
293281
// assert there is no root item
294282
expect(items.at(0).attributes()).toEqual({
295-
hasslash: 'true',
296283
url: references[parentTopicIdentifiers[0]].url,
297284
iscollapsed: 'true',
298285
});
299286
expect(items.at(0).classes()).not.toContain('root-hierarchy');
300287

301288
// next assert the collapsible items. 3, as 1 can live between 800 and 1000
302289
expect(items.at(1).attributes()).toEqual({
303-
hasslash: 'true',
304290
iscollapsed: 'true',
305291
url: references[parentTopicIdentifiers[1]].url,
306292
});
307293
expect(items.at(2).attributes()).toEqual({
308-
hasslash: 'true',
309294
iscollapsed: 'true',
310295
url: references[parentTopicIdentifiers[2]].url,
311296
});
312297
expect(items.at(3).attributes()).toEqual({
313-
hasslash: 'true',
314298
iscollapsed: 'true',
315299
url: references[parentTopicIdentifiers[3]].url,
316300
});
317301
// assert the items outside of the collapse
318302
expect(items.at(4).attributes()).toEqual({
319-
hasslash: 'true',
320303
url: references[parentTopicIdentifiers[4]].url,
321304
});
322305
expect(items.at(5).attributes()).toEqual({
323-
hasslash: 'true',
324306
});
325307

326308
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -352,35 +334,29 @@ describe('Hierarchy', () => {
352334
// assert what items are shown
353335
// assert there is no root item
354336
expect(items.at(0).attributes()).toEqual({
355-
hasslash: 'true',
356337
url: references[parentTopicIdentifiers[0]].url,
357338
iscollapsed: 'true',
358339
});
359340
expect(items.at(0).classes()).not.toContain('root-hierarchy');
360341

361342
// next assert the collapsible items. 4, as 0 can live outside below 800
362343
expect(items.at(1).attributes()).toEqual({
363-
hasslash: 'true',
364344
iscollapsed: 'true',
365345
url: references[parentTopicIdentifiers[1]].url,
366346
});
367347
expect(items.at(2).attributes()).toEqual({
368-
hasslash: 'true',
369348
iscollapsed: 'true',
370349
url: references[parentTopicIdentifiers[2]].url,
371350
});
372351
expect(items.at(3).attributes()).toEqual({
373-
hasslash: 'true',
374352
iscollapsed: 'true',
375353
url: references[parentTopicIdentifiers[3]].url,
376354
});
377355
expect(items.at(4).attributes()).toEqual({
378-
hasslash: 'true',
379356
iscollapsed: 'true',
380357
url: references[parentTopicIdentifiers[4]].url,
381358
});
382359
expect(items.at(5).attributes()).toEqual({
383-
hasslash: 'true',
384360
});
385361

386362
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -432,26 +408,21 @@ describe('Hierarchy', () => {
432408

433409
// next assert the collapsible items. Two, as 2 can live outside at 1200 with tags
434410
expect(items.at(1).attributes()).toEqual({
435-
hasslash: 'true',
436411
iscollapsed: 'true',
437412
url: references[parentTopicIdentifiers[1]].url,
438413
});
439414
expect(items.at(2).attributes()).toEqual({
440-
hasslash: 'true',
441415
iscollapsed: 'true',
442416
url: references[parentTopicIdentifiers[2]].url,
443417
});
444418
// assert the items outside of the collapse
445419
expect(items.at(3).attributes()).toEqual({
446-
hasslash: 'true',
447420
url: references[parentTopicIdentifiers[3]].url,
448421
});
449422
expect(items.at(4).attributes()).toEqual({
450-
hasslash: 'true',
451423
url: references[parentTopicIdentifiers[4]].url,
452424
});
453425
expect(items.at(5).attributes()).toEqual({
454-
hasslash: 'true',
455426
});
456427

457428
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -483,27 +454,22 @@ describe('Hierarchy', () => {
483454

484455
// assert the collapsible items. 3 collapsed, as 1 can live outside between 1000 - 1200
485456
expect(items.at(1).attributes()).toEqual({
486-
hasslash: 'true',
487457
iscollapsed: 'true',
488458
url: references[parentTopicIdentifiers[1]].url,
489459
});
490460
expect(items.at(2).attributes()).toEqual({
491-
hasslash: 'true',
492461
iscollapsed: 'true',
493462
url: references[parentTopicIdentifiers[2]].url,
494463
});
495464
expect(items.at(3).attributes()).toEqual({
496-
hasslash: 'true',
497465
iscollapsed: 'true',
498466
url: references[parentTopicIdentifiers[3]].url,
499467
});
500468
// assert the items outside of the collapse
501469
expect(items.at(4).attributes()).toEqual({
502-
hasslash: 'true',
503470
url: references[parentTopicIdentifiers[4]].url,
504471
});
505472
expect(items.at(5).attributes()).toEqual({
506-
hasslash: 'true',
507473
});
508474

509475
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -535,35 +501,29 @@ describe('Hierarchy', () => {
535501
// assert what items are shown
536502
// assert there is no root item
537503
expect(items.at(0).attributes()).toEqual({
538-
hasslash: 'true',
539504
url: references[parentTopicIdentifiers[0]].url,
540505
iscollapsed: 'true',
541506
});
542507
expect(items.at(0).classes()).not.toContain('root-hierarchy');
543508

544509
// next assert the collapsible items. 3, as 1 can live between 800 and 1000
545510
expect(items.at(1).attributes()).toEqual({
546-
hasslash: 'true',
547511
iscollapsed: 'true',
548512
url: references[parentTopicIdentifiers[1]].url,
549513
});
550514
expect(items.at(2).attributes()).toEqual({
551-
hasslash: 'true',
552515
iscollapsed: 'true',
553516
url: references[parentTopicIdentifiers[2]].url,
554517
});
555518
expect(items.at(3).attributes()).toEqual({
556-
hasslash: 'true',
557519
iscollapsed: 'true',
558520
url: references[parentTopicIdentifiers[3]].url,
559521
});
560522
expect(items.at(4).attributes()).toEqual({
561-
hasslash: 'true',
562523
iscollapsed: 'true',
563524
url: references[parentTopicIdentifiers[4]].url,
564525
});
565526
expect(items.at(5).attributes()).toEqual({
566-
hasslash: 'true',
567527
});
568528

569529
// assert there is a `HierarchyCollapsedItems` rendered, with correct items
@@ -603,35 +563,29 @@ describe('Hierarchy', () => {
603563
// assert what items are shown
604564
// assert there is no root item
605565
expect(items.at(0).attributes()).toEqual({
606-
hasslash: 'true',
607566
url: references[parentTopicIdentifiers[0]].url,
608567
iscollapsed: 'true',
609568
});
610569
expect(items.at(0).classes()).not.toContain('root-hierarchy');
611570

612571
// next assert the collapsible items. 3, as 1 can live between 800 and 1000
613572
expect(items.at(1).attributes()).toEqual({
614-
hasslash: 'true',
615573
iscollapsed: 'true',
616574
url: references[parentTopicIdentifiers[1]].url,
617575
});
618576
expect(items.at(2).attributes()).toEqual({
619-
hasslash: 'true',
620577
iscollapsed: 'true',
621578
url: references[parentTopicIdentifiers[2]].url,
622579
});
623580
expect(items.at(3).attributes()).toEqual({
624-
hasslash: 'true',
625581
iscollapsed: 'true',
626582
url: references[parentTopicIdentifiers[3]].url,
627583
});
628584
expect(items.at(4).attributes()).toEqual({
629-
hasslash: 'true',
630585
iscollapsed: 'true',
631586
url: references[parentTopicIdentifiers[4]].url,
632587
});
633588
expect(items.at(5).attributes()).toEqual({
634-
hasslash: 'true',
635589
});
636590

637591
// assert there is a `HierarchyCollapsedItems` rendered, with correct items

tests/unit/components/DocumentationTopic/HierarchyCollapsedItems.spec.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ describe('HierarchyCollapsedItems', () => {
4545
expect(wrapper.is('li.hierarchy-collapsed-items')).toBe(true);
4646
});
4747

48-
it('renders a slash instead of an icon', () => {
49-
expect(wrapper.find('.hierarchy-item-icon').text()).toBe('/');
50-
});
51-
5248
it('renders a non-focused button', () => {
5349
const btn = wrapper.find('button.toggle');
5450
expect(btn.exists()).toBe(true);

tests/unit/components/DocumentationTopic/HierarchyItem.spec.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ describe('HierarchyItem', () => {
3333
expect(wrapper.classes('collapsed')).toBe(true);
3434
});
3535

36-
it('renders a slash instead of an icon', () => {
37-
const wrapper = mountWithProps({ url: 'foo.bar' });
38-
39-
expect(wrapper.find('.hierarchy-item-icon').text()).toBe('/');
40-
});
41-
4236
it('renders a .parent.item link if the URL exists', () => {
4337
const wrapper = mountWithProps({ url: 'foo.bar' });
4438
const item = wrapper.find('.item');

0 commit comments

Comments
 (0)