-
-
Notifications
You must be signed in to change notification settings - Fork 115
Update table of contents component to glimmer #809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9ef65ab
c01eb96
afcf2c2
97bc2dc
0acb8de
3c4bb40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<ol class='toc-level-0'> | ||
<li class='toc-level-0'> | ||
<a {{action 'toggle' 'modules'}} href='#' data-test-toc-title='packages'>Packages</a> | ||
<ol class='toc-level-1 modules selected'> | ||
{{#each @moduleIDs as |moduleID|}} | ||
|
||
{{#if (not-eq moduleID '@ember/object/computed')}} | ||
<li class='toc-level-1' data-test-module={{moduleID}}> | ||
<LinkTo @route='project-version.modules.module' @models={{array @version moduleID}}>{{moduleID}}</LinkTo> | ||
</li> | ||
{{/if}} | ||
|
||
{{/each}} | ||
</ol> | ||
</li> | ||
|
||
{{#if @isShowingNamespaces}} | ||
<li class='toc-level-0'> | ||
<a {{action 'toggle' 'namespaces'}} href='#' data-test-toc-title='namespaces'>Namespaces</a> | ||
<ol class='toc-level-1 namespaces selected'> | ||
{{#each @namespaceIDs as |namespaceID|}} | ||
<li class='toc-level-1' data-test-namespace={{namespaceID}}> | ||
<LinkTo @route='project-version.namespaces.namespace' @models={{array @version namespaceID}}>{{namespaceID}}</LinkTo> | ||
</li> | ||
{{/each}} | ||
</ol> | ||
</li> | ||
{{/if}} | ||
|
||
<li class='toc-level-0'> | ||
<a {{action 'toggle' 'classes'}} href='#' data-test-toc-title='classes'>Classes</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is good that these didn't change in this case, but we'll definitely want to switch to |
||
<ol class='toc-level-1 classes selected'> | ||
{{#each @classesIDs as |classID|}} | ||
<li class='toc-level-1' data-test-class={{classID}}> | ||
<LinkTo @route='project-version.classes.class' @models={{array @version classID}}>{{classID}}</LinkTo> | ||
</li> | ||
{{/each}} | ||
</ol> | ||
</li> | ||
</ol> | ||
<label class='toc-private-toggle'> | ||
<Input @type='checkbox' @checked={{@showPrivateClasses}} class='private-deprecated-toggle' /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this is the two-way binding we'll want to replace. |
||
Show Private / Deprecated | ||
</label> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,18 +12,16 @@ module('Integration | Component | table of contents', function (hooks) { | |
|
||
test('it renders', async function (assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
this.set('projectId', 'Ember'); | ||
this.set('emberVersion', '2.4.3'); | ||
this.set('classesIDs', CLASSES); | ||
|
||
await render(hbs` | ||
{{ | ||
table-of-contents showPrivateClasses=true | ||
projectid=projectId | ||
version=emberVersion | ||
classesIDs=classesIDs | ||
isShowingNamespaces=true | ||
}} | ||
<TableOfContents | ||
@showPrivateClasses={{true}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for a follow-on: this currently uses two-way binding between an |
||
@version={{this.emberVersion}} | ||
@classesIDs={{this.classesIDs}} | ||
@isShowingNamespaces={{true}} | ||
/> | ||
`); | ||
|
||
const contentTitle = document.querySelector( | ||
|
@@ -41,18 +39,16 @@ module('Integration | Component | table of contents', function (hooks) { | |
|
||
test('Starts with underlying content visible', async function (assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
this.set('projectId', 'Ember'); | ||
this.set('emberVersion', '2.4.3'); | ||
this.set('moduleIDs', MODULES); | ||
|
||
await render(hbs` | ||
{{ | ||
table-of-contents showPrivateClasses=true | ||
projectid=projectId | ||
version=emberVersion | ||
moduleIDs=moduleIDs | ||
isShowingNamespaces=true | ||
}} | ||
<TableOfContents | ||
@showPrivateClasses={{true}} | ||
@version={{this.emberVersion}} | ||
@moduleIDs={{this.moduleIDs}} | ||
@isShowingNamespaces={{true}} | ||
/> | ||
`); | ||
|
||
const contentReference = '.toc-level-1'; | ||
|
@@ -73,18 +69,16 @@ module('Integration | Component | table of contents', function (hooks) { | |
|
||
test('Underlying content hides once clicked', async function (assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
this.set('projectId', 'Ember'); | ||
this.set('emberVersion', '2.4.3'); | ||
this.set('moduleIDs', MODULES); | ||
|
||
await render(hbs` | ||
{{ | ||
table-of-contents showPrivateClasses=true | ||
projectid=projectId | ||
version=emberVersion | ||
moduleIDs=moduleIDs | ||
isShowingNamespaces=true | ||
}} | ||
<TableOfContents | ||
@showPrivateClasses={{true}} | ||
@version={{this.emberVersion}} | ||
@moduleIDs={{this.moduleIDs}} | ||
@isShowingNamespaces={{true}} | ||
/> | ||
`); | ||
|
||
const contentTitle = document.querySelector( | ||
|
@@ -109,18 +103,16 @@ module('Integration | Component | table of contents', function (hooks) { | |
|
||
test('Underlying content should be visible after 2 clicks', async function (assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
this.set('projectId', 'Ember'); | ||
this.set('emberVersion', '2.4.3'); | ||
this.set('moduleIDs', MODULES); | ||
|
||
await render(hbs` | ||
{{ | ||
table-of-contents showPrivateClasses=true | ||
projectid=projectId | ||
version=emberVersion | ||
moduleIDs=moduleIDs | ||
isShowingNamespaces=true | ||
}} | ||
<TableOfContents | ||
@showPrivateClasses={{true}} | ||
@version={{this.emberVersion}} | ||
@moduleIDs={{this.moduleIDs}} | ||
@isShowingNamespaces={{true}} | ||
/> | ||
`); | ||
|
||
const titleButton = document.querySelector( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One note: this is not going to have the exact same DOM as we had before, in two ways:
...attributes
, which@ember/component
implicitly did.div
.In this case, that should be fine: the rendering doesn't depend on the wrapping element (I checked!), but I wanted to flag it up for anyone who reads this PR later.