Skip to content

Commit b2482ee

Browse files
authored
Merge pull request #885 from ember-learn/remove-collapse-logic
Remove the collapse functionality
2 parents 26e59a6 + 63d04c1 commit b2482ee

File tree

5 files changed

+19
-112
lines changed

5 files changed

+19
-112
lines changed

app/components/table-of-contents.hbs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ul class='table-of-contents '>
2-
<li class='toc-item toc-group'>
3-
<a {{on 'click' (fn this.toggle 'modules')}} href='#' data-test-toc-title='packages'>Packages</a>
4-
<ul class='sub-table-of-contents modules selected'>
2+
<li class='toc-item toc-group' data-test-toc-title="packages">
3+
Packages
4+
<ul class='sub-table-of-contents modules'>
55
{{#each @moduleIDs as |moduleID|}}
66

77
{{#if (not-eq moduleID '@ember/object/computed')}}
@@ -15,9 +15,9 @@
1515
</li>
1616

1717
{{#if @isShowingNamespaces}}
18-
<li class='table-of-contents'>
19-
<a {{on 'click' (fn this.toggle 'namespaces')}} href='#' data-test-toc-title='namespaces'>Namespaces</a>
20-
<ul class='sub-table-of-contents namespaces selected'>
18+
<li class='table-of-contents' data-test-toc-title="namespaces">
19+
Namespaces
20+
<ul class='sub-table-of-contents namespaces'>
2121
{{#each @namespaceIDs as |namespaceID|}}
2222
<li class='toc-item toc-link' data-test-namespace={{namespaceID}}>
2323
<LinkTo @route='project-version.namespaces.namespace' @models={{array @version namespaceID}}>{{namespaceID}}</LinkTo>
@@ -27,9 +27,9 @@
2727
</li>
2828
{{/if}}
2929

30-
<li class='table-of-contents '>
31-
<a {{on 'click' (fn this.toggle 'classes')}} href='#' data-test-toc-title='classes'>Classes</a>
32-
<ul class='sub-table-of-contents classes selected'>
30+
<li class='table-of-contents' data-test-toc-title="classes">
31+
Classes
32+
<ul class='sub-table-of-contents classes'>
3333
{{#each @classesIDs as |classID|}}
3434
<li class='toc-item toc-link' data-test-class={{classID}}>
3535
<LinkTo @route='project-version.classes.class' @models={{array @version classID}}>{{classID}}</LinkTo>

app/components/table-of-contents.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/components/table-of-projects.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<ul class="table-of-contents ">
1+
<ul class="table-of-contents">
22
<li class="toc-item" data-test-home>
33
<LinkTo @route="project" @model="ember">Home</LinkTo>
44
</li>
5-
<li class="toc-heading">Projects</li>
5+
<li>Projects</li>
66
<ul class="sub-table-of-contents">
77
<li class="toc-item"><LinkTo @route="project" @model="ember" @current-when={{eq @activeProject "ember"}} class="spec-ember">Ember</LinkTo></li>
88
<li class="toc-item"><LinkTo @route="project" @model="ember-data" @current-when={{eq @activeProject "ember-data"}} class="spec-ember-data">EmberData</LinkTo></li>

app/styles/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ main a.edit-icon {
7979
.table-of-contents li {
8080
margin: 3px 0;
8181
list-style-type: none;
82+
color: var(--color-gray-600);
8283
}
8384

8485
li.toc-heading {
Lines changed: 7 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { module, test, skip } from 'qunit';
1+
import { module, test } from 'qunit';
22
import { setupRenderingTest } from 'ember-qunit';
3-
import { render, findAll, click } from '@ember/test-helpers';
3+
import { render, findAll } from '@ember/test-helpers';
44
import hbs from 'htmlbars-inline-precompile';
55

6-
const TIMEOUT_FOR_ANIMATION = 600;
76
const CLASSES = ['Descriptor', 'Ember'];
87
const MODULES = ['@ember/application', '@ember/array'];
98

109
module('Integration | Component | table of contents', function (hooks) {
1110
setupRenderingTest(hooks);
1211

13-
test('it renders', async function (assert) {
12+
test('it renders classes', async function (assert) {
1413
// Set any properties with this.set('myProperty', 'value');
1514
this.set('emberVersion', '2.4.3');
1615
this.set('classesIDs', CLASSES);
@@ -29,15 +28,15 @@ module('Integration | Component | table of contents', function (hooks) {
2928
);
3029
const contentReference = '.sub-table-of-contents';
3130

32-
assert.dom(contentTitle).hasText('Classes');
31+
assert.dom(contentTitle).includesText('Classes');
3332
assert
3433
.dom(`${contentReference} li`)
3534
.exists({ count: 2 }, 'We have two items to display');
3635
assert.dom(findAll(`${contentReference} li`)[0]).hasText(CLASSES[0]);
3736
assert.dom(findAll(`${contentReference} li`)[1]).hasText(CLASSES[1]);
3837
});
3938

40-
test('Starts with underlying content visible', async function (assert) {
39+
test('it renders packages', async function (assert) {
4140
// Set any properties with this.set('myProperty', 'value');
4241
this.set('emberVersion', '2.4.3');
4342
this.set('moduleIDs', MODULES);
@@ -54,96 +53,15 @@ module('Integration | Component | table of contents', function (hooks) {
5453
const contentReference = '.sub-table-of-contents';
5554
const content = document.querySelector(contentReference);
5655
const contentTitle = document.querySelector(
57-
'[data-test-toc-title="classes"]'
56+
'[data-test-toc-title="packages"]'
5857
);
5958

60-
assert.dom(contentTitle).hasText('Classes');
61-
assert.dom(content).hasClass('selected');
59+
assert.dom(contentTitle).includesText('Packages');
6260
assert
6361
.dom(`${contentReference} li`)
6462
.exists({ count: 2 }, 'We have two items to display');
6563
assert.dom(content).isVisible();
6664
assert.dom(findAll(`${contentReference} li`)[0]).hasText(MODULES[0]);
6765
assert.dom(findAll(`${contentReference} li`)[1]).hasText(MODULES[1]);
6866
});
69-
70-
skip('Underlying content hides once clicked', async function (assert) {
71-
// Set any properties with this.set('myProperty', 'value');
72-
this.set('emberVersion', '2.4.3');
73-
this.set('moduleIDs', MODULES);
74-
75-
await render(hbs`
76-
<TableOfContents
77-
@showPrivateClasses={{true}}
78-
@version={{this.emberVersion}}
79-
@moduleIDs={{this.moduleIDs}}
80-
@isShowingNamespaces={{true}}
81-
/>
82-
`);
83-
84-
const contentTitle = document.querySelector(
85-
'[data-test-toc-title="packages"]'
86-
);
87-
const contentReference = '.sub-table-of-content';
88-
const content = document.querySelector(contentReference);
89-
90-
assert.dom(contentTitle).hasText('Packages');
91-
assert.dom(content).hasClass('selected');
92-
assert.dom(content).isVisible();
93-
94-
await click(contentTitle);
95-
96-
const done = assert.async();
97-
setTimeout(() => {
98-
assert.dom(content).isNotVisible();
99-
assert.dom(content).doesNotHaveClass('selected');
100-
done();
101-
}, TIMEOUT_FOR_ANIMATION);
102-
});
103-
104-
skip('Underlying content should be visible after 2 clicks', async function (assert) {
105-
// Set any properties with this.set('myProperty', 'value');
106-
this.set('emberVersion', '2.4.3');
107-
this.set('moduleIDs', MODULES);
108-
109-
await render(hbs`
110-
<TableOfContents
111-
@showPrivateClasses={{true}}
112-
@version={{this.emberVersion}}
113-
@moduleIDs={{this.moduleIDs}}
114-
@isShowingNamespaces={{true}}
115-
/>
116-
`);
117-
118-
const titleButton = document.querySelector(
119-
'[data-test-toc-title="packages"]'
120-
);
121-
const contentReference = '.sub-table-of-contents';
122-
const content = document.querySelector(contentReference);
123-
124-
assert.dom(titleButton).hasText('Packages');
125-
assert.dom(content).hasClass('selected');
126-
assert.dom(content).isVisible();
127-
128-
await click(titleButton);
129-
130-
const done1 = assert.async();
131-
132-
setTimeout(async () => {
133-
assert.dom(content).isNotVisible();
134-
assert.dom(content).doesNotHaveClass('selected');
135-
136-
await click(titleButton);
137-
138-
const done2 = assert.async();
139-
140-
setTimeout(() => {
141-
assert.dom(content).isVisible();
142-
assert.dom(content).hasClass('selected');
143-
done2();
144-
}, TIMEOUT_FOR_ANIMATION);
145-
146-
done1();
147-
}, TIMEOUT_FOR_ANIMATION);
148-
});
14967
});

0 commit comments

Comments
 (0)