File tree 4 files changed +25
-7
lines changed
addon/components/docs-snippet
test-apps/new-addon/tests
4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 14
14
docs-relative docs-subpixel-antialiased
15
15
{{ if title " docs-rounded-b" " docs-rounded" }}
16
16
"
17
- data-test-id ={{ name }}
17
+ data-test-id ={{ or data-test-id name }}
18
18
>
19
19
{{ #with (get-code-snippet name unindent =unindent ) as |snippet |}}
20
20
{{ #if showCopy }}
Original file line number Diff line number Diff line change @@ -128,10 +128,19 @@ module.exports = {
128
128
includer . options . snippetSearchPaths = [ 'tests/dummy/app' ] ;
129
129
}
130
130
}
131
- includer . options . snippetRegexes = Object . assign ( { } , {
132
- begin : / (?: { { # | < ) (?: D o c s S n i p p e t | d o c s - s n i p p e t | d e m o \. e x a m p l e ) \s @ ? n a m e = [ ' " ] ( \S * ) [ ' " ] / ,
133
- end : / (?: { { | < ) \/ (?: D o c s S n i p p e t | d o c s - s n i p p e t | d e m o \. e x a m p l e ) (?: } } | > ) / ,
134
- } , includer . options . snippetRegexes ) ;
131
+
132
+ if ( ! includer . options . snippetRegexes ) {
133
+ includer . options . snippetRegexes = [
134
+ {
135
+ begin : / { { # (?: d o c s - s n i p p e t | d e m o \. e x a m p l e ) \s n a m e = [ ' " ] ( \S * ) [ ' " ] / ,
136
+ end : / { { \/ (?: d o c s - s n i p p e t | d e m o \. e x a m p l e ) } } / ,
137
+ } ,
138
+ {
139
+ begin : / < (?: D o c s S n i p p e t | d e m o \. e x a m p l e ) \s @ n a m e = [ ' " ] ( \S * ) [ ' " ] [ ^ / ] * > / ,
140
+ end : / < \/ (?: D o c s S n i p p e t | d e m o \. e x a m p l e ) > /
141
+ }
142
+ ] ;
143
+ }
135
144
136
145
let snippetExtensions = includer . options . snippetExtensions ;
137
146
Original file line number Diff line number Diff line change @@ -2,13 +2,18 @@ import { module, test } from 'qunit';
2
2
import { visit , fillIn } from '@ember/test-helpers' ;
3
3
import { setupApplicationTest } from 'ember-qunit' ;
4
4
5
- const snippetIds = [ 'your-snippet-name.hbs' , 'your-angle-bracket-snippet-name.hbs' ] ;
5
+ const snippetIds = [
6
+ 'your-snippet-name.hbs' ,
7
+ 'your-angle-bracket-snippet-name.hbs' ,
8
+ 'standalone-curlies' ,
9
+ 'standalone-angle-brackets'
10
+ ] ;
6
11
7
12
module ( 'Acceptance | snippets' , function ( hooks ) {
8
13
setupApplicationTest ( hooks ) ;
9
14
10
15
test ( 'snippets support both classic & angle bracket invocation' , async function ( assert ) {
11
- assert . expect ( 13 ) ;
16
+ assert . expect ( 17 ) ;
12
17
13
18
await visit ( '/snippets' ) ;
14
19
Original file line number Diff line number Diff line change 20
20
</div >
21
21
</DocsSnippet >
22
22
23
+ {{ docs-snippet name =" your-snippet-name.hbs" data-test-id =" standalone-curlies" }}
24
+
25
+ <DocsSnippet @name =" your-angle-bracket-snippet-name.hbs" @data-test-id =" standalone-angle-brackets" />
26
+
23
27
{{ #docs-demo data-test-id =" docs-demo-basic.hbs" as |demo |}}
24
28
{{ #demo.example name =" docs-demo-basic.hbs" }}
25
29
<p >I am a <strong >handlebars</strong > template!</p >
You can’t perform that action at this time.
0 commit comments