@@ -75,83 +75,29 @@ describe("DOM contract", function () {
7575 expect ( count ) . toBe ( 1 ) ;
7676 } ) ;
7777
78- it ( "has pub-tab data-qs when configured" , async function ( ) {
79- const result = await browser . executeObsidian ( ( ) => {
80- const tabs = document . querySelectorAll ( '[data-qs="pub-tab"]' ) ;
81- const configured = Boolean (
82- (
83- app as unknown as {
84- plugins : {
85- plugins : Record <
86- string ,
87- { settings ?: { gitRemoteUrl ?: string } }
88- > ;
89- } ;
90- }
91- ) . plugins . plugins [ "quartz-syncer" ] ?. settings ?. gitRemoteUrl ,
92- ) ;
93- return { count : tabs . length , configured } ;
78+ it ( "has pub-tab data-qs" , async function ( ) {
79+ const count = await browser . executeObsidian ( ( ) => {
80+ return document . querySelectorAll ( '[data-qs="pub-tab"]' ) . length ;
9481 } ) ;
95- if ( result . configured ) {
96- expect ( result . count ) . toBe ( 2 ) ;
97- } else {
98- expect ( result . count ) . toBe ( 0 ) ;
99- }
82+ expect ( count ) . toBe ( 2 ) ;
10083 } ) ;
10184
102- it ( "has pub-publish-btn when configured" , async function ( ) {
103- const result = await browser . executeObsidian ( ( ) => {
104- const publish = document . querySelector (
105- '[data-qs="pub-publish-btn"]' ,
85+ it ( "has pub-publish-btn" , async function ( ) {
86+ const hasPublish = await browser . executeObsidian ( ( ) => {
87+ return (
88+ document . querySelector ( '[data-qs="pub-publish-btn"]' ) !==
89+ null
10690 ) ;
107- const configured = Boolean (
108- (
109- app as unknown as {
110- plugins : {
111- plugins : Record <
112- string ,
113- { settings ?: { gitRemoteUrl ?: string } }
114- > ;
115- } ;
116- }
117- ) . plugins . plugins [ "quartz-syncer" ] ?. settings ?. gitRemoteUrl ,
118- ) ;
119- return {
120- hasPublish : publish !== null ,
121- configured,
122- } ;
12391 } ) ;
124- if ( result . configured ) {
125- expect ( result . hasPublish ) . toBe ( true ) ;
126- } else {
127- expect ( result . hasPublish ) . toBe ( false ) ;
128- }
92+ expect ( hasPublish ) . toBe ( true ) ;
12993 } ) ;
13094
131- it ( "has pub-search when configured" , async function ( ) {
132- const result = await browser . executeObsidian ( ( ) => {
133- const search = document . querySelectorAll (
134- '[data-qs="pub-search"]' ,
135- ) ;
136- const configured = Boolean (
137- (
138- app as unknown as {
139- plugins : {
140- plugins : Record <
141- string ,
142- { settings ?: { gitRemoteUrl ?: string } }
143- > ;
144- } ;
145- }
146- ) . plugins . plugins [ "quartz-syncer" ] ?. settings ?. gitRemoteUrl ,
147- ) ;
148- return { count : search . length , configured } ;
95+ it ( "has pub-search" , async function ( ) {
96+ const count = await browser . executeObsidian ( ( ) => {
97+ return document . querySelectorAll ( '[data-qs="pub-search"]' )
98+ . length ;
14999 } ) ;
150- if ( result . configured ) {
151- expect ( result . count ) . toBe ( 1 ) ;
152- } else {
153- expect ( result . count ) . toBe ( 0 ) ;
154- }
100+ expect ( count ) . toBe ( 1 ) ;
155101 } ) ;
156102 } ) ;
157103} ) ;
0 commit comments