@@ -3,7 +3,6 @@ import { mockConfig, mockLoadConfigInit } from '@stencil/core/testing';
33import type * as d from '../../../declarations' ;
44import { validateConfig } from '../../config/validate-config' ;
55import { getCustomElementsBuildConditionals } from '../dist-custom-elements/custom-elements-build-conditionals' ;
6- import { getHydrateBuildConditionals } from '../dist-hydrate-script/hydrate-build-conditionals' ;
76import { getLazyBuildConditionals } from '../dist-lazy/lazy-build-conditionals' ;
87
98describe ( 'build-conditionals' , ( ) => {
@@ -16,16 +15,6 @@ describe('build-conditionals', () => {
1615 } ) ;
1716
1817 describe ( 'getCustomElementsBuildConditionals' , ( ) => {
19- it ( 'default' , ( ) => {
20- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
21- const bc = getCustomElementsBuildConditionals ( config , cmps ) ;
22- expect ( bc ) . toMatchObject ( {
23- lazyLoad : false ,
24- hydrateClientSide : false ,
25- hydrateServerSide : false ,
26- } ) ;
27- } ) ;
28-
2918 it ( 'taskQueue async' , ( ) => {
3019 userConfig . taskQueue = 'async' ;
3120 const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
@@ -60,37 +49,9 @@ describe('build-conditionals', () => {
6049 expect ( bc . taskQueue ) . toBe ( true ) ;
6150 expect ( config . taskQueue ) . toBe ( 'async' ) ;
6251 } ) ;
63-
64- it ( 'hydrateClientSide true' , ( ) => {
65- const hydrateOutputTarget : d . OutputTargetHydrate = {
66- type : 'dist-hydrate-script' ,
67- } ;
68- userConfig . outputTargets = [ hydrateOutputTarget ] ;
69- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
70- const bc = getCustomElementsBuildConditionals ( config , cmps ) ;
71- expect ( bc . hydrateClientSide ) . toBe ( true ) ;
72- } ) ;
73-
74- it ( 'hydratedSelectorName' , ( ) => {
75- userConfig . hydratedFlag = {
76- name : 'boooop' ,
77- } ;
78- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
79- const bc = getCustomElementsBuildConditionals ( config , cmps ) ;
80- expect ( bc . hydratedSelectorName ) . toBe ( 'boooop' ) ;
81- } ) ;
8252 } ) ;
8353
8454 describe ( 'getLazyBuildConditionals' , ( ) => {
85- it ( 'default' , ( ) => {
86- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
87- const bc = getLazyBuildConditionals ( config , cmps ) ;
88- expect ( bc ) . toMatchObject ( {
89- lazyLoad : true ,
90- hydrateServerSide : false ,
91- } ) ;
92- } ) ;
93-
9455 it ( 'taskQueue async' , ( ) => {
9556 userConfig . taskQueue = 'async' ;
9657 const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
@@ -138,61 +99,5 @@ describe('build-conditionals', () => {
13899 const bc = getLazyBuildConditionals ( config , cmps ) ;
139100 expect ( bc . transformTagName ) . toBe ( true ) ;
140101 } ) ;
141-
142- it ( 'hydrateClientSide default' , ( ) => {
143- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
144- const bc = getLazyBuildConditionals ( config , cmps ) ;
145- expect ( bc . hydrateClientSide ) . toBe ( false ) ;
146- } ) ;
147-
148- it ( 'hydrateClientSide true' , ( ) => {
149- const hydrateOutputTarget : d . OutputTargetHydrate = {
150- type : 'dist-hydrate-script' ,
151- } ;
152- userConfig . outputTargets = [ hydrateOutputTarget ] ;
153- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
154- const bc = getLazyBuildConditionals ( config , cmps ) ;
155- expect ( bc . hydrateClientSide ) . toBe ( true ) ;
156- } ) ;
157-
158- it ( 'hydratedSelectorName' , ( ) => {
159- userConfig . hydratedFlag = {
160- name : 'boooop' ,
161- } ;
162- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
163- const bc = getLazyBuildConditionals ( config , cmps ) ;
164- expect ( bc . hydratedSelectorName ) . toBe ( 'boooop' ) ;
165- } ) ;
166- } ) ;
167-
168- describe ( 'getHydrateBuildConditionals' , ( ) => {
169- it ( 'hydratedSelectorName' , ( ) => {
170- userConfig . hydratedFlag = {
171- name : 'boooop' ,
172- } ;
173- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
174- const bc = getHydrateBuildConditionals ( config , cmps ) ;
175- expect ( bc . hydratedSelectorName ) . toBe ( 'boooop' ) ;
176- } ) ;
177-
178- it ( 'should allow setting to use a class for hydration' , ( ) => {
179- userConfig . hydratedFlag = {
180- selector : 'class' ,
181- } ;
182- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
183- const bc = getHydrateBuildConditionals ( config , cmps ) ;
184- expect ( bc . hydratedClass ) . toBe ( true ) ;
185- expect ( bc . hydratedAttribute ) . toBe ( false ) ;
186- } ) ;
187-
188- it ( 'should allow setting to use an attr for hydration' , ( ) => {
189- userConfig . hydratedFlag = {
190- selector : 'attribute' ,
191- } ;
192- const { config } = validateConfig ( userConfig , mockLoadConfigInit ( ) ) ;
193- const bc = getHydrateBuildConditionals ( config , cmps ) ;
194- expect ( bc . hydratedClass ) . toBe ( false ) ;
195- expect ( bc . hydratedAttribute ) . toBe ( true ) ;
196- } ) ;
197102 } ) ;
198103} ) ;
0 commit comments