File tree Expand file tree Collapse file tree 4 files changed +39
-4
lines changed
templates/project-version/modules
tests/integration/helpers Expand file tree Collapse file tree 4 files changed +39
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { helper } from '@ember/component/helper' ;
2
+ import { A } from '@ember/array' ;
3
+
4
+ export function functionHeadingId ( [ heading ] /*, hash*/ ) {
5
+ return `functions-${ A ( heading . split ( '/' ) ) . get ( 'lastObject' ) } ` ;
6
+ }
7
+
8
+ export default helper ( functionHeadingId ) ;
Original file line number Diff line number Diff line change 15
15
16
16
{{ #if submodules }}
17
17
<section >
18
- <h2 >Submodules</h2 >
18
+ <h2 id =" submodules" class =" anchorable-toc" >
19
+ <a href =" #submodules" class =" toc-anchor" ></a >
20
+ Submodules
21
+ </h2 >
19
22
<ul class =" spec-method-list" >
20
23
{{ #each submodules as |module |}}
21
24
<li >
30
33
31
34
{{ #if classesAndNamespaces }}
32
35
<section >
33
- <h2 >Classes</h2 >
36
+ <h2 id =" classes" class =" anchorable-toc" >
37
+ <a href =" #classes" class =" toc-anchor" ></a >
38
+ Classes
39
+ </h2 >
34
40
<ul class =" spec-property-list" >
35
41
{{ #each classesAndNamespaces as |klass |}}
36
42
{{ #if (not (and (eq model.name " ember-data" ) (eq klass " Ember" )))}}
47
53
48
54
{{ #if (and functionHeadings (gt functionHeadings.length 0 )) }}
49
55
50
- <h2 >Functions</h2 >
56
+ <h2 id =" functions" class =" anchorable-toc" >
57
+ <a href =" #functions" class =" toc-anchor" ></a >
58
+ Functions
59
+ </h2 >
51
60
{{ #each functionHeadings as |funcHeading |}}
52
- <h4 >{{ funcHeading }} </h4 >
61
+ <h4 id =" {{ function-heading-id funcHeading }} " class =" anchorable-toc" >
62
+ <a href =" #{{ function-heading-id funcHeading }} " class =" toc-anchor" ></a >
63
+ {{ funcHeading }}
64
+ </h4 >
53
65
<ul class =" spec-method-list" >
54
66
{{ #each (better-get functions funcHeading ) as |method |}}
55
67
<li >
Original file line number Diff line number Diff line change
1
+
2
+ import { moduleForComponent , test } from 'ember-qunit' ;
3
+ import hbs from 'htmlbars-inline-precompile' ;
4
+
5
+ moduleForComponent ( 'function-heading-id' , 'helper:function-heading-id' , {
6
+ integration : true
7
+ } ) ;
8
+
9
+ test ( 'should transform nested package to id' , function ( assert ) {
10
+ this . set ( 'inputValue' , '@ember/object/computed' ) ;
11
+
12
+ this . render ( hbs `{{function-heading-id inputValue}}` ) ;
13
+
14
+ assert . equal ( this . $ ( ) . text ( ) . trim ( ) , 'functions-computed' ) ;
15
+ } ) ;
You can’t perform that action at this time.
0 commit comments