1616 * pages/
1717 * slides/
1818 * index.md
19+ * about-me.md
1920 * index.md
2021 */
2122import chai from "chai" ;
@@ -65,7 +66,7 @@ describe("Build Greenwood With: ", function () {
6566
6667 runSmokeTest ( [ "public" , "index" ] , LABEL ) ;
6768
68- describe ( "Custom Default App and Page Layout " , function ( ) {
69+ describe ( "App and Custom Index Page Layouts for the home page " , function ( ) {
6970 let dom ;
7071
7172 before ( async function ( ) {
@@ -80,6 +81,43 @@ describe("Build Greenwood With: ", function () {
8081 ) ;
8182 } ) ;
8283
84+ it ( "should have expected <body> content from the index layout" , function ( ) {
85+ const customElement = dom . window . document . querySelectorAll ( "body presenter-mode" ) ;
86+
87+ expect ( customElement . length ) . to . equal ( 1 ) ;
88+ } ) ;
89+
90+ it ( "should have expected <head> content from the index layout" , function ( ) {
91+ const scriptTags = dom . window . document . querySelectorAll ( "head script" ) ;
92+ const tags = Array . from ( scriptTags ) . filter ( ( tag ) => tag . getAttribute ( "type" ) === "module" ) ;
93+
94+ expect ( tags . length ) . to . equal ( 1 ) ;
95+ } ) ;
96+
97+ it ( "should NOT have any content from the index page since index layout has no <content-outlet></content-outlet> tag" , function ( ) {
98+ const h3 = dom . window . document . querySelectorAll ( "body h3" ) ;
99+ const h4 = dom . window . document . querySelectorAll ( "body h3" ) ;
100+
101+ expect ( h3 . length ) . to . equal ( 0 ) ;
102+ expect ( h4 . length ) . to . equal ( 0 ) ;
103+ } ) ;
104+ } ) ;
105+
106+ describe ( "Default App and Page Layouts for the about page" , function ( ) {
107+ let dom ;
108+
109+ before ( async function ( ) {
110+ dom = await JSDOM . fromFile ( path . resolve ( this . context . publicDir , "about-me/index.html" ) ) ;
111+ } ) ;
112+
113+ it ( "should have expected text from from a mock package layout/app.html in node_modules/" , function ( ) {
114+ const pageLayoutHeading = dom . window . document . querySelectorAll ( "body h1" ) [ 0 ] ;
115+
116+ expect ( pageLayoutHeading . textContent ) . to . be . equal (
117+ "This is a custom app layout from the custom layouts directory." ,
118+ ) ;
119+ } ) ;
120+
83121 it ( "should have expected text from from a mock package layout/page.html in node_modules/" , function ( ) {
84122 const pageLayoutHeading = dom . window . document . querySelectorAll ( "body h2" ) [ 0 ] ;
85123
@@ -90,10 +128,10 @@ describe("Build Greenwood With: ", function () {
90128
91129 it ( "should have expected text from user workspace pages/index.md" , function ( ) {
92130 const pageHeadingPrimary = dom . window . document . querySelectorAll ( "body h3" ) [ 0 ] ;
93- const pageHeadingSecondary = dom . window . document . querySelectorAll ( "body h4 " ) [ 0 ] ;
131+ const pageHeadingSecondary = dom . window . document . querySelectorAll ( "body p " ) [ 0 ] ;
94132
95- expect ( pageHeadingPrimary . textContent ) . to . be . equal ( "Context Plugin Theme Pack Test " ) ;
96- expect ( pageHeadingSecondary . textContent ) . to . be . equal ( "From user workspace pages/index.md " ) ;
133+ expect ( pageHeadingPrimary . textContent ) . to . be . equal ( "About Me " ) ;
134+ expect ( pageHeadingSecondary . textContent ) . to . be . equal ( "Hello from me! " ) ;
97135 } ) ;
98136 } ) ;
99137
0 commit comments