File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed
addon/components/docs-snippet
test-apps/new-addon/tests Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 1414 docs-relative docs-subpixel-antialiased
1515 {{ if title " docs-rounded-b" " docs-rounded" }}
1616 "
17- data-test-id ={{ name }}
17+ data-test-id ={{ or data-test-id name }}
1818>
1919 {{ #with (get-code-snippet name unindent =unindent ) as |snippet |}}
2020 {{ #if showCopy }}
Original file line number Diff line number Diff line change @@ -128,10 +128,19 @@ module.exports = {
128128 includer . options . snippetSearchPaths = [ 'tests/dummy/app' ] ;
129129 }
130130 }
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+ }
135144
136145 let snippetExtensions = includer . options . snippetExtensions ;
137146
Original file line number Diff line number Diff line change @@ -2,13 +2,18 @@ import { module, test } from 'qunit';
22import { visit , fillIn } from '@ember/test-helpers' ;
33import { setupApplicationTest } from 'ember-qunit' ;
44
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+ ] ;
611
712module ( 'Acceptance | snippets' , function ( hooks ) {
813 setupApplicationTest ( hooks ) ;
914
1015 test ( 'snippets support both classic & angle bracket invocation' , async function ( assert ) {
11- assert . expect ( 13 ) ;
16+ assert . expect ( 17 ) ;
1217
1318 await visit ( '/snippets' ) ;
1419
Original file line number Diff line number Diff line change 2020 </div >
2121</DocsSnippet >
2222
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+
2327{{ #docs-demo data-test-id =" docs-demo-basic.hbs" as |demo |}}
2428 {{ #demo.example name =" docs-demo-basic.hbs" }}
2529 <p >I am a <strong >handlebars</strong > template!</p >
You can’t perform that action at this time.
0 commit comments