@qwickapps/react-framework 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QUICK_START_GUIDE.md +82 -0
- package/README.md +231 -21
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +1 -2
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/SafeSpan.d.ts +1 -2
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/base/Container.d.ts +32 -0
- package/dist/components/base/Container.d.ts.map +1 -0
- package/dist/components/base/ContainerView.d.ts +65 -0
- package/dist/components/base/ContainerView.d.ts.map +1 -0
- package/dist/components/base/ModelView.d.ts +37 -46
- package/dist/components/base/ModelView.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -2
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/blocks/Article.d.ts +1 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code-factory.d.ts +22 -0
- package/dist/components/blocks/Code-factory.d.ts.map +1 -0
- package/dist/components/blocks/Code-old.d.ts +31 -0
- package/dist/components/blocks/Code-old.d.ts.map +1 -0
- package/dist/components/blocks/Code.d.ts +30 -18
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +1 -2
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +1 -2
- package/dist/components/blocks/Image.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +1 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +35 -27
- package/dist/components/blocks/Text.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +1 -2
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +1 -2
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +1 -2
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +1 -2
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +29 -47
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -3
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/components/shared/createSerializableView.d.ts +68 -0
- package/dist/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/components/shared/viewProps.d.ts +37 -0
- package/dist/components/shared/viewProps.d.ts.map +1 -0
- package/dist/index.esm.js +21782 -22580
- package/dist/index.js +21782 -22579
- package/dist/qa/ConsoleWarningTest.d.ts +5 -0
- package/dist/qa/ConsoleWarningTest.d.ts.map +1 -0
- package/dist/qa/StorageKeyTest.d.ts +6 -0
- package/dist/qa/StorageKeyTest.d.ts.map +1 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts +6 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts.map +1 -0
- package/dist/schemas/CodeSchema.d.ts +2 -2
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/ContainerSchema.d.ts +12 -0
- package/dist/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +3 -3
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -1
- package/dist/schemas/ViewModelSchema.d.ts +46 -6
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -1
- package/dist/schemas/ViewSchema.d.ts +65 -0
- package/dist/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +27 -15
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/registry.d.ts +3 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -1
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/src/components/AccessibilityChecker.d.ts +12 -0
- package/dist/src/components/AccessibilityChecker.d.ts.map +1 -0
- package/dist/src/components/AccessibilityProvider.d.ts +64 -0
- package/dist/src/components/AccessibilityProvider.d.ts.map +1 -0
- package/dist/src/components/Breadcrumbs.d.ts +39 -0
- package/dist/src/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/ErrorBoundary.d.ts +46 -0
- package/dist/src/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/components/Html.d.ts +58 -0
- package/dist/src/components/Html.d.ts.map +1 -0
- package/dist/src/components/Logo.d.ts +56 -0
- package/dist/src/components/Logo.d.ts.map +1 -0
- package/dist/src/components/Markdown.d.ts +51 -0
- package/dist/src/components/Markdown.d.ts.map +1 -0
- package/dist/src/components/QwickApp.d.ts +69 -0
- package/dist/src/components/QwickApp.d.ts.map +1 -0
- package/dist/src/components/QwickAppsLogo.d.ts +25 -0
- package/dist/src/components/QwickAppsLogo.d.ts.map +1 -0
- package/dist/src/components/QwickIcon.d.ts +23 -0
- package/dist/src/components/QwickIcon.d.ts.map +1 -0
- package/dist/src/components/ResponsiveMenu.d.ts +38 -0
- package/dist/src/components/ResponsiveMenu.d.ts.map +1 -0
- package/dist/src/components/SafeSpan.d.ts +29 -0
- package/dist/src/components/SafeSpan.d.ts.map +1 -0
- package/dist/src/components/Scaffold.d.ts +57 -0
- package/dist/src/components/Scaffold.d.ts.map +1 -0
- package/dist/src/components/base/Container.d.ts +33 -0
- package/dist/src/components/base/Container.d.ts.map +1 -0
- package/dist/src/components/base/ModelView.d.ts +92 -0
- package/dist/src/components/base/ModelView.d.ts.map +1 -0
- package/dist/src/components/base/index.d.ts +12 -0
- package/dist/src/components/base/index.d.ts.map +1 -0
- package/dist/src/components/blocks/Article.d.ts +32 -0
- package/dist/src/components/blocks/Article.d.ts.map +1 -0
- package/dist/src/components/blocks/CardListGrid.d.ts +23 -0
- package/dist/src/components/blocks/CardListGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Code.d.ts +37 -0
- package/dist/src/components/blocks/Code.d.ts.map +1 -0
- package/dist/src/components/blocks/Content.d.ts +24 -0
- package/dist/src/components/blocks/Content.d.ts.map +1 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts +44 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureCard.d.ts +66 -0
- package/dist/src/components/blocks/FeatureCard.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts +48 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Footer.d.ts +56 -0
- package/dist/src/components/blocks/Footer.d.ts.map +1 -0
- package/dist/src/components/blocks/HeroBlock.d.ts +55 -0
- package/dist/src/components/blocks/HeroBlock.d.ts.map +1 -0
- package/dist/src/components/blocks/Image.d.ts +40 -0
- package/dist/src/components/blocks/Image.d.ts.map +1 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts +30 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/ProductCard.d.ts +57 -0
- package/dist/src/components/blocks/ProductCard.d.ts.map +1 -0
- package/dist/src/components/blocks/Section.d.ts +45 -0
- package/dist/src/components/blocks/Section.d.ts.map +1 -0
- package/dist/src/components/blocks/Text.d.ts +34 -0
- package/dist/src/components/blocks/Text.d.ts.map +1 -0
- package/dist/src/components/blocks/index.d.ts +41 -0
- package/dist/src/components/blocks/index.d.ts.map +1 -0
- package/dist/src/components/buttons/Button.d.ts +41 -0
- package/dist/src/components/buttons/Button.d.ts.map +1 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/index.d.ts +11 -0
- package/dist/src/components/buttons/index.d.ts.map +1 -0
- package/dist/src/components/forms/FormBlock.d.ts +51 -0
- package/dist/src/components/forms/FormBlock.d.ts.map +1 -0
- package/dist/src/components/forms/index.d.ts +8 -0
- package/dist/src/components/forms/index.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +41 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/input/ChoiceInputField.d.ts +29 -0
- package/dist/src/components/input/ChoiceInputField.d.ts.map +1 -0
- package/dist/src/components/input/HtmlInputField.d.ts +33 -0
- package/dist/src/components/input/HtmlInputField.d.ts.map +1 -0
- package/dist/src/components/input/SelectInputField.d.ts +31 -0
- package/dist/src/components/input/SelectInputField.d.ts.map +1 -0
- package/dist/src/components/input/SwitchInputField.d.ts +27 -0
- package/dist/src/components/input/SwitchInputField.d.ts.map +1 -0
- package/dist/src/components/input/TextField.d.ts +18 -0
- package/dist/src/components/input/TextField.d.ts.map +1 -0
- package/dist/src/components/input/TextInputField.d.ts +34 -0
- package/dist/src/components/input/TextInputField.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +19 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts +34 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts +9 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts.map +1 -0
- package/dist/src/components/layout/GridCell.d.ts +32 -0
- package/dist/src/components/layout/GridCell.d.ts.map +1 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts +46 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts.map +1 -0
- package/dist/src/components/layout/GridLayout.d.ts +50 -0
- package/dist/src/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/src/components/layout/index.d.ts +14 -0
- package/dist/src/components/layout/index.d.ts.map +1 -0
- package/dist/src/components/menu/Menu.d.ts +1 -0
- package/dist/src/components/menu/Menu.d.ts.map +1 -0
- package/dist/src/components/menu/MenuItem.d.ts +31 -0
- package/dist/src/components/menu/MenuItem.d.ts.map +1 -0
- package/dist/src/components/menu/index.d.ts +7 -0
- package/dist/src/components/menu/index.d.ts.map +1 -0
- package/dist/src/components/pages/FormPage.d.ts +66 -0
- package/dist/src/components/pages/FormPage.d.ts.map +1 -0
- package/dist/src/components/pages/Page.d.ts +68 -0
- package/dist/src/components/pages/Page.d.ts.map +1 -0
- package/dist/src/components/pages/index.d.ts +10 -0
- package/dist/src/components/pages/index.d.ts.map +1 -0
- package/dist/src/components/shared/createSerializableView.d.ts +81 -0
- package/dist/src/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/src/components/shared/viewProps.d.ts +37 -0
- package/dist/src/components/shared/viewProps.d.ts.map +1 -0
- package/dist/src/config/AppConfig.d.ts +49 -0
- package/dist/src/config/AppConfig.d.ts.map +1 -0
- package/dist/src/config/AppConfigBuilder.d.ts +75 -0
- package/dist/src/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +13 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/types.d.ts +130 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/contexts/DataContext.d.ts +139 -0
- package/dist/src/contexts/DataContext.d.ts.map +1 -0
- package/dist/src/contexts/DimensionsContext.d.ts +42 -0
- package/dist/src/contexts/DimensionsContext.d.ts.map +1 -0
- package/dist/src/contexts/PaletteContext.d.ts +53 -0
- package/dist/src/contexts/PaletteContext.d.ts.map +1 -0
- package/dist/src/contexts/PrintModeContext.d.ts +27 -0
- package/dist/src/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/src/contexts/QwickAppContext.d.ts +71 -0
- package/dist/src/contexts/QwickAppContext.d.ts.map +1 -0
- package/dist/src/contexts/ThemeContext.d.ts +65 -0
- package/dist/src/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/src/contexts/index.d.ts +11 -0
- package/dist/src/contexts/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +12 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useBaseProps.d.ts +101 -0
- package/dist/src/hooks/useBaseProps.d.ts.map +1 -0
- package/dist/src/hooks/useDataBinding.d.ts +22 -0
- package/dist/src/hooks/useDataBinding.d.ts.map +1 -0
- package/dist/src/hooks/usePrintMode.d.ts +39 -0
- package/dist/src/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/palettes/PaletteAutumn.d.ts +10 -0
- package/dist/src/palettes/PaletteAutumn.d.ts.map +1 -0
- package/dist/src/palettes/PaletteCosmic.d.ts +10 -0
- package/dist/src/palettes/PaletteCosmic.d.ts.map +1 -0
- package/dist/src/palettes/PaletteDefault.d.ts +10 -0
- package/dist/src/palettes/PaletteDefault.d.ts.map +1 -0
- package/dist/src/palettes/PaletteOcean.d.ts +10 -0
- package/dist/src/palettes/PaletteOcean.d.ts.map +1 -0
- package/dist/src/palettes/PaletteSpring.d.ts +10 -0
- package/dist/src/palettes/PaletteSpring.d.ts.map +1 -0
- package/dist/src/palettes/PaletteWinter.d.ts +10 -0
- package/dist/src/palettes/PaletteWinter.d.ts.map +1 -0
- package/dist/src/palettes/index.d.ts +13 -0
- package/dist/src/palettes/index.d.ts.map +1 -0
- package/dist/src/schemas/ActionSchema.d.ts +21 -0
- package/dist/src/schemas/ActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/ArticleSchema.d.ts +13 -0
- package/dist/src/schemas/ArticleSchema.d.ts.map +1 -0
- package/dist/src/schemas/ButtonSchema.d.ts +19 -0
- package/dist/src/schemas/ButtonSchema.d.ts.map +1 -0
- package/dist/src/schemas/CardListGridSchema.d.ts +17 -0
- package/dist/src/schemas/CardListGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/CodeSchema.d.ts +18 -0
- package/dist/src/schemas/CodeSchema.d.ts.map +1 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts +32 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContainerSchema.d.ts +12 -0
- package/dist/src/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContentSchema.d.ts +21 -0
- package/dist/src/schemas/ContentSchema.d.ts.map +1 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts +28 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts +17 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts +16 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterItemSchema.d.ts +15 -0
- package/dist/src/schemas/FooterItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSchema.d.ts +20 -0
- package/dist/src/schemas/FooterSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts +15 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/FormBlockSchema.d.ts +19 -0
- package/dist/src/schemas/FormBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridCellSchema.d.ts +23 -0
- package/dist/src/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts +21 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts +17 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts +22 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlSchema.d.ts +14 -0
- package/dist/src/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/src/schemas/ImageSchema.d.ts +32 -0
- package/dist/src/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/src/schemas/LogoSchema.d.ts +35 -0
- package/dist/src/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/src/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/src/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts +13 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts +16 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/src/schemas/ProductCardSchema.d.ts +39 -0
- package/dist/src/schemas/ProductCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts +13 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts.map +1 -0
- package/dist/src/schemas/SectionSchema.d.ts +16 -0
- package/dist/src/schemas/SectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts +27 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts +22 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextSchema.d.ts +37 -0
- package/dist/src/schemas/TextSchema.d.ts.map +1 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts +19 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/ViewSchema.d.ts +66 -0
- package/dist/src/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts +47 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts +128 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/registry.d.ts +18 -0
- package/dist/src/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/src/schemas/types/Serializable.d.ts +46 -0
- package/dist/src/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts +44 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts.map +1 -0
- package/dist/src/templates/TemplateResolver.d.ts +52 -0
- package/dist/src/templates/TemplateResolver.d.ts.map +1 -0
- package/dist/src/templates/index.d.ts +7 -0
- package/dist/src/templates/index.d.ts.map +1 -0
- package/dist/src/types/CacheProvider.d.ts +18 -0
- package/dist/src/types/CacheProvider.d.ts.map +1 -0
- package/dist/src/types/CollapsibleLayout.d.ts +142 -0
- package/dist/src/types/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/types/ContentProxy.d.ts +47 -0
- package/dist/src/types/ContentProxy.d.ts.map +1 -0
- package/dist/src/types/DataTypes.d.ts +185 -0
- package/dist/src/types/DataTypes.d.ts.map +1 -0
- package/dist/src/types/TemplateProvider.d.ts +10 -0
- package/dist/src/types/TemplateProvider.d.ts.map +1 -0
- package/dist/src/types/TemplateResolver.d.ts +23 -0
- package/dist/src/types/TemplateResolver.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +82 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/breakpoints.d.ts +35 -0
- package/dist/src/utils/breakpoints.d.ts.map +1 -0
- package/dist/src/utils/cssUtils.d.ts +17 -0
- package/dist/src/utils/cssUtils.d.ts.map +1 -0
- package/dist/src/utils/customPaletteManager.d.ts +8 -0
- package/dist/src/utils/customPaletteManager.d.ts.map +1 -0
- package/dist/src/utils/dimensions.d.ts +34 -0
- package/dist/src/utils/dimensions.d.ts.map +1 -0
- package/dist/src/utils/htmlTransform.d.ts +44 -0
- package/dist/src/utils/htmlTransform.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +16 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +26 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/paletteUtils.d.ts +38 -0
- package/dist/src/utils/paletteUtils.d.ts.map +1 -0
- package/dist/src/utils/persistenceUtils.d.ts +31 -0
- package/dist/src/utils/persistenceUtils.d.ts.map +1 -0
- package/dist/src/utils/reactUtils.d.ts +33 -0
- package/dist/src/utils/reactUtils.d.ts.map +1 -0
- package/dist/src/utils/spacing.d.ts +34 -0
- package/dist/src/utils/spacing.d.ts.map +1 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts +32 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts.map +1 -0
- package/dist/src/utils/themeUtils.d.ts +27 -0
- package/dist/src/utils/themeUtils.d.ts.map +1 -0
- package/dist/utils/cssUtils.d.ts +17 -0
- package/dist/utils/cssUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/scripts/bundle-css.cjs +27 -0
- package/scripts/create-project.sh +28 -0
- package/scripts/create-qwickapps-project.js +284 -0
- package/src/__tests__/components/base/Container.test.tsx +966 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +1 -1
- package/src/__tests__/schemas/ViewSchema.test.ts +805 -0
- package/src/__tests__/schemas/builders.test.ts +2 -2
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +19 -19
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +13 -13
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +39 -39
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +14 -14
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +8 -8
- package/src/__tests__/schemas/transformers/nested-serialization.test.tsx +181 -0
- package/src/__tests__/schemas/transformers/round-trip-component-serialization.test.tsx +458 -0
- package/src/__tests__/test_image_accessibility.test.tsx +226 -0
- package/src/__tests__/utils/optional-logging.test.ts +3 -3
- package/src/components/Html.tsx +24 -15
- package/src/components/Logo.tsx +2 -2
- package/src/components/Markdown.tsx +2 -7
- package/src/components/SafeSpan.tsx +2 -7
- package/src/components/base/Container.tsx +61 -0
- package/src/components/base/ModelView.tsx +225 -91
- package/src/components/base/index.ts +3 -2
- package/src/components/blocks/Article.tsx +2 -7
- package/src/components/blocks/CardListGrid.tsx +2 -2
- package/src/components/blocks/Code.tsx +91 -179
- package/src/components/blocks/Content.tsx +2 -2
- package/src/components/blocks/CoverImageHeader.tsx +2 -2
- package/src/components/blocks/HeroBlock.tsx +54 -146
- package/src/components/blocks/Image.tsx +82 -196
- package/src/components/blocks/PageBannerHeader.tsx +2 -2
- package/src/components/blocks/Section.tsx +79 -181
- package/src/components/blocks/Text.tsx +100 -198
- package/src/components/buttons/Button.tsx +85 -183
- package/src/components/buttons/PaletteSwitcher.tsx +2 -2
- package/src/components/buttons/ThemeSwitcher.tsx +2 -2
- package/src/components/forms/FormBlock.tsx +2 -2
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +76 -160
- package/src/components/input/HtmlInputField.tsx +141 -264
- package/src/components/input/SelectInputField.tsx +48 -153
- package/src/components/input/SwitchInputField.tsx +41 -139
- package/src/components/input/TextInputField.tsx +39 -116
- package/src/components/layout/GridCell.tsx +36 -122
- package/src/components/layout/GridLayout.tsx +55 -127
- package/src/components/pages/Page.tsx +268 -276
- package/src/components/pages/index.ts +2 -3
- package/src/components/shared/createSerializableView.tsx +280 -0
- package/src/components/shared/viewProps.ts +207 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +2 -2
- package/src/contexts/DataContext.tsx +1 -1
- package/src/schemas/ButtonSchema.ts +3 -2
- package/src/schemas/CardListGridSchema.ts +3 -2
- package/src/schemas/ChoiceInputFieldSchema.ts +3 -2
- package/src/schemas/CodeSchema.ts +8 -6
- package/src/schemas/ContainerSchema.ts +25 -0
- package/src/schemas/FeatureCardSchema.ts +1 -1
- package/src/schemas/FormBlockSchema.ts +3 -2
- package/src/schemas/GridCellSchema.ts +4 -10
- package/src/schemas/GridLayoutSchema.ts +8 -14
- package/src/schemas/HeroBlockSchema.ts +3 -2
- package/src/schemas/HtmlInputFieldSchema.ts +3 -2
- package/src/schemas/ImageSchema.ts +3 -2
- package/src/schemas/PageTemplateSchema.ts +5 -5
- package/src/schemas/SectionSchema.ts +4 -12
- package/src/schemas/SelectInputFieldSchema.ts +3 -2
- package/src/schemas/SwitchInputFieldSchema.ts +2 -2
- package/src/schemas/TextInputFieldSchema.ts +3 -2
- package/src/schemas/ViewSchema.ts +570 -0
- package/src/schemas/index.ts +1 -1
- package/src/schemas/transformers/ComponentTransformer.ts +185 -163
- package/src/schemas/transformers/ReactNodeTransformer.ts +31 -28
- package/src/schemas/transformers/registry.ts +17 -10
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ChoiceInputField.stories.tsx +28 -1
- package/src/stories/Code.stories.tsx +61 -1
- package/src/stories/Container.stories.tsx +954 -0
- package/src/stories/FormBlock.stories.tsx +54 -0
- package/src/stories/FormComponents.stories.tsx +8 -13
- package/src/stories/GridCell.stories.tsx +23 -64
- package/src/stories/GridLayout.stories.tsx +22 -47
- package/src/stories/HeroBlock.stories.tsx +28 -0
- package/src/stories/HtmlInputField.stories.tsx +23 -1
- package/src/stories/Image.stories.tsx +45 -233
- package/src/stories/Markdown.stories.tsx +1 -1
- package/src/stories/Section.stories.tsx +38 -4
- package/src/stories/SelectInputField.stories.tsx +26 -1
- package/src/stories/Text.stories.tsx +22 -54
- package/src/stories/TextInputField.stories.tsx +24 -1
- package/src/stories/_templates/SerializationTemplate.tsx +165 -0
- package/src/templates/TemplateResolver.ts +2 -2
- package/src/types/CollapsibleLayout.ts +2 -2
- package/src/utils/cssUtils.ts +49 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +13 -13
- package/src/__tests__/components/base/ModelView.test.tsx +0 -220
- package/src/__tests__/schemas/ViewModelSchema.test.ts +0 -80
- package/src/components/blocks/Code.md +0 -529
- package/src/schemas/README.md +0 -661
- package/src/schemas/ViewModelSchema.ts +0 -115
- package/src/tests/ConsoleWarningTest.tsx +0 -30
- package/src/tests/StorageKeyTest.tsx +0 -110
- package/src/tests/ThemeStorageKeyTest.tsx +0 -114
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewSchema Tests - Comprehensive v2.0.0 Test Suite
|
|
3
|
+
*
|
|
4
|
+
* Tests for ViewSchema functionality and validation covering all 40+ fields
|
|
5
|
+
* including grid props, dimensions, spacing, backgrounds, styles, HTML attributes,
|
|
6
|
+
* accessibility properties, and event handlers.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ViewSchema } from '../../schemas/ViewSchema';
|
|
10
|
+
|
|
11
|
+
describe('ViewSchema v2.0.0', () => {
|
|
12
|
+
|
|
13
|
+
// ========================================
|
|
14
|
+
// BASIC SCHEMA TESTS
|
|
15
|
+
// ========================================
|
|
16
|
+
|
|
17
|
+
describe('Schema Metadata', () => {
|
|
18
|
+
it('should create a valid ViewSchema instance', () => {
|
|
19
|
+
const viewModel = new ViewSchema();
|
|
20
|
+
expect(viewModel).toBeInstanceOf(ViewSchema);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should have correct schema metadata for v1.0.0', () => {
|
|
24
|
+
const schema = ViewSchema.getSchema();
|
|
25
|
+
expect(schema.name).toBe('ViewSchema');
|
|
26
|
+
expect(schema.version).toBe('1.0.0');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should handle empty instance without errors', async () => {
|
|
30
|
+
const data = {};
|
|
31
|
+
const result = await ViewSchema.validate(data);
|
|
32
|
+
expect(result.isValid).toBe(true);
|
|
33
|
+
expect(result.errors).toHaveLength(0);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// ========================================
|
|
38
|
+
// GRID LAYOUT PROPS TESTS
|
|
39
|
+
// ========================================
|
|
40
|
+
|
|
41
|
+
describe('Grid Layout Props', () => {
|
|
42
|
+
const validSpanValues = ['auto', 'grow', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
|
|
43
|
+
const validBreakpointValues = ['auto', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
|
|
44
|
+
|
|
45
|
+
describe('span property', () => {
|
|
46
|
+
it('should accept all valid span values', async () => {
|
|
47
|
+
for (const value of validSpanValues) {
|
|
48
|
+
const data = { span: value };
|
|
49
|
+
const result = await ViewSchema.validate(data);
|
|
50
|
+
expect(result.isValid).toBe(true);
|
|
51
|
+
expect(result.errors).toHaveLength(0);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should reject invalid span values', async () => {
|
|
56
|
+
const invalidValues = ['13', '0', 'invalid', 'full', ''];
|
|
57
|
+
for (const value of invalidValues) {
|
|
58
|
+
const data = { span: value };
|
|
59
|
+
const result = await ViewSchema.validate(data);
|
|
60
|
+
expect(result.isValid).toBe(false);
|
|
61
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('breakpoint properties (xs, sm, md, lg, xl)', () => {
|
|
67
|
+
const breakpointProps = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
68
|
+
|
|
69
|
+
it('should accept all valid breakpoint values for all breakpoints', async () => {
|
|
70
|
+
for (const prop of breakpointProps) {
|
|
71
|
+
for (const value of validBreakpointValues) {
|
|
72
|
+
const data = { [prop]: value };
|
|
73
|
+
const result = await ViewSchema.validate(data);
|
|
74
|
+
expect(result.isValid).toBe(true);
|
|
75
|
+
expect(result.errors).toHaveLength(0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('should reject invalid breakpoint values', async () => {
|
|
81
|
+
const invalidValues = ['13', '0', 'grow', 'invalid', ''];
|
|
82
|
+
for (const prop of breakpointProps) {
|
|
83
|
+
for (const value of invalidValues) {
|
|
84
|
+
const data = { [prop]: value };
|
|
85
|
+
const result = await ViewSchema.validate(data);
|
|
86
|
+
expect(result.isValid).toBe(false);
|
|
87
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should allow all breakpoints to be set together', async () => {
|
|
93
|
+
const data = {
|
|
94
|
+
span: 'auto',
|
|
95
|
+
xs: '12',
|
|
96
|
+
sm: '6',
|
|
97
|
+
md: '4',
|
|
98
|
+
lg: '3',
|
|
99
|
+
xl: '2'
|
|
100
|
+
};
|
|
101
|
+
const result = await ViewSchema.validate(data);
|
|
102
|
+
expect(result.isValid).toBe(true);
|
|
103
|
+
expect(result.errors).toHaveLength(0);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// ========================================
|
|
109
|
+
// STYLING PROPS TESTS
|
|
110
|
+
// ========================================
|
|
111
|
+
|
|
112
|
+
describe('Styling Props', () => {
|
|
113
|
+
it('should accept valid className', async () => {
|
|
114
|
+
const data = { className: 'custom-class-name another-class' };
|
|
115
|
+
const result = await ViewSchema.validate(data);
|
|
116
|
+
expect(result.isValid).toBe(true);
|
|
117
|
+
expect(result.errors).toHaveLength(0);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should accept valid sx prop as JSON string', async () => {
|
|
121
|
+
const data = { sx: '{"color": "primary.main", "fontWeight": "bold"}' };
|
|
122
|
+
const result = await ViewSchema.validate(data);
|
|
123
|
+
expect(result.isValid).toBe(true);
|
|
124
|
+
expect(result.errors).toHaveLength(0);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should accept valid style prop as JSON string', async () => {
|
|
128
|
+
const data = { style: '{"color": "red", "margin": "10px", "fontSize": "14px"}' };
|
|
129
|
+
const result = await ViewSchema.validate(data);
|
|
130
|
+
expect(result.isValid).toBe(true);
|
|
131
|
+
expect(result.errors).toHaveLength(0);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('should reject non-string styling values', async () => {
|
|
135
|
+
const invalidData = [
|
|
136
|
+
{ className: 123 },
|
|
137
|
+
{ sx: { color: 'red' } },
|
|
138
|
+
{ style: { margin: '10px' } }
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
for (const data of invalidData) {
|
|
142
|
+
const result = await ViewSchema.validate(data);
|
|
143
|
+
expect(result.isValid).toBe(false);
|
|
144
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should accept empty strings for styling props', async () => {
|
|
149
|
+
const data = {
|
|
150
|
+
className: '',
|
|
151
|
+
sx: '',
|
|
152
|
+
style: ''
|
|
153
|
+
};
|
|
154
|
+
const result = await ViewSchema.validate(data);
|
|
155
|
+
expect(result.isValid).toBe(true);
|
|
156
|
+
expect(result.errors).toHaveLength(0);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// ========================================
|
|
161
|
+
// DIMENSION PROPS TESTS
|
|
162
|
+
// ========================================
|
|
163
|
+
|
|
164
|
+
describe('Dimension Props', () => {
|
|
165
|
+
const dimensionProps = ['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'];
|
|
166
|
+
|
|
167
|
+
it('should accept valid dimension values', async () => {
|
|
168
|
+
const validValues = [
|
|
169
|
+
'auto',
|
|
170
|
+
'grow',
|
|
171
|
+
'small',
|
|
172
|
+
'medium',
|
|
173
|
+
'large',
|
|
174
|
+
'300px',
|
|
175
|
+
'50%',
|
|
176
|
+
'50vh',
|
|
177
|
+
'100vw',
|
|
178
|
+
'fit-content',
|
|
179
|
+
'max-content',
|
|
180
|
+
'min-content'
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
for (const prop of dimensionProps) {
|
|
184
|
+
for (const value of validValues) {
|
|
185
|
+
const data = { [prop]: value };
|
|
186
|
+
const result = await ViewSchema.validate(data);
|
|
187
|
+
expect(result.isValid).toBe(true);
|
|
188
|
+
expect(result.errors).toHaveLength(0);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should reject non-string dimension values', async () => {
|
|
194
|
+
for (const prop of dimensionProps) {
|
|
195
|
+
const data = { [prop]: 300 }; // number instead of string
|
|
196
|
+
const result = await ViewSchema.validate(data);
|
|
197
|
+
expect(result.isValid).toBe(false);
|
|
198
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('should allow all dimension props to be set together', async () => {
|
|
203
|
+
const data = {
|
|
204
|
+
width: 'large',
|
|
205
|
+
height: 'medium',
|
|
206
|
+
minWidth: 'small',
|
|
207
|
+
minHeight: '100px',
|
|
208
|
+
maxWidth: '1200px',
|
|
209
|
+
maxHeight: '80vh'
|
|
210
|
+
};
|
|
211
|
+
const result = await ViewSchema.validate(data);
|
|
212
|
+
expect(result.isValid).toBe(true);
|
|
213
|
+
expect(result.errors).toHaveLength(0);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// ========================================
|
|
218
|
+
// SPACING PROPS TESTS
|
|
219
|
+
// ========================================
|
|
220
|
+
|
|
221
|
+
describe('Spacing Props', () => {
|
|
222
|
+
const spacingSizes = ['none', 'tiny', 'small', 'medium', 'large', 'huge'];
|
|
223
|
+
const paddingProps = ['padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY'];
|
|
224
|
+
const marginProps = ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY'];
|
|
225
|
+
const allSpacingProps = [...paddingProps, ...marginProps];
|
|
226
|
+
|
|
227
|
+
it('should accept all valid spacing sizes for padding props', async () => {
|
|
228
|
+
for (const prop of paddingProps) {
|
|
229
|
+
for (const size of spacingSizes) {
|
|
230
|
+
const data = { [prop]: size };
|
|
231
|
+
const result = await ViewSchema.validate(data);
|
|
232
|
+
expect(result.isValid).toBe(true);
|
|
233
|
+
expect(result.errors).toHaveLength(0);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('should accept all valid spacing sizes for margin props', async () => {
|
|
239
|
+
for (const prop of marginProps) {
|
|
240
|
+
for (const size of spacingSizes) {
|
|
241
|
+
const data = { [prop]: size };
|
|
242
|
+
const result = await ViewSchema.validate(data);
|
|
243
|
+
expect(result.isValid).toBe(true);
|
|
244
|
+
expect(result.errors).toHaveLength(0);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('should reject invalid spacing sizes', async () => {
|
|
250
|
+
const invalidSizes = ['extra-small', 'xl', 'jumbo', 'micro', '', '0', '10px'];
|
|
251
|
+
|
|
252
|
+
for (const prop of allSpacingProps) {
|
|
253
|
+
for (const size of invalidSizes) {
|
|
254
|
+
const data = { [prop]: size };
|
|
255
|
+
const result = await ViewSchema.validate(data);
|
|
256
|
+
expect(result.isValid).toBe(false);
|
|
257
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('should allow all padding props to be set together', async () => {
|
|
263
|
+
const data = {
|
|
264
|
+
padding: 'medium',
|
|
265
|
+
paddingTop: 'large',
|
|
266
|
+
paddingRight: 'small',
|
|
267
|
+
paddingBottom: 'tiny',
|
|
268
|
+
paddingLeft: 'none',
|
|
269
|
+
paddingX: 'huge',
|
|
270
|
+
paddingY: 'medium'
|
|
271
|
+
};
|
|
272
|
+
const result = await ViewSchema.validate(data);
|
|
273
|
+
expect(result.isValid).toBe(true);
|
|
274
|
+
expect(result.errors).toHaveLength(0);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should allow all margin props to be set together', async () => {
|
|
278
|
+
const data = {
|
|
279
|
+
margin: 'small',
|
|
280
|
+
marginTop: 'medium',
|
|
281
|
+
marginRight: 'large',
|
|
282
|
+
marginBottom: 'huge',
|
|
283
|
+
marginLeft: 'tiny',
|
|
284
|
+
marginX: 'none',
|
|
285
|
+
marginY: 'small'
|
|
286
|
+
};
|
|
287
|
+
const result = await ViewSchema.validate(data);
|
|
288
|
+
expect(result.isValid).toBe(true);
|
|
289
|
+
expect(result.errors).toHaveLength(0);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('should reject non-string spacing values', async () => {
|
|
293
|
+
for (const prop of allSpacingProps) {
|
|
294
|
+
const data = { [prop]: 10 }; // number instead of string
|
|
295
|
+
const result = await ViewSchema.validate(data);
|
|
296
|
+
expect(result.isValid).toBe(false);
|
|
297
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ========================================
|
|
303
|
+
// BACKGROUND PROPS TESTS
|
|
304
|
+
// ========================================
|
|
305
|
+
|
|
306
|
+
describe('Background Props', () => {
|
|
307
|
+
it('should accept valid background color values', async () => {
|
|
308
|
+
const validBackgrounds = [
|
|
309
|
+
'#ffffff',
|
|
310
|
+
'#ff0000',
|
|
311
|
+
'primary.main',
|
|
312
|
+
'secondary.light',
|
|
313
|
+
'transparent',
|
|
314
|
+
'red',
|
|
315
|
+
'rgba(255, 0, 0, 0.5)',
|
|
316
|
+
'hsl(120, 100%, 50%)'
|
|
317
|
+
];
|
|
318
|
+
|
|
319
|
+
for (const bg of validBackgrounds) {
|
|
320
|
+
const data = { background: bg };
|
|
321
|
+
const result = await ViewSchema.validate(data);
|
|
322
|
+
expect(result.isValid).toBe(true);
|
|
323
|
+
expect(result.errors).toHaveLength(0);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it('should accept valid background image URLs', async () => {
|
|
328
|
+
const validImages = [
|
|
329
|
+
'https://example.com/image.jpg',
|
|
330
|
+
'https://picsum.photos/800/600',
|
|
331
|
+
'/local/image.png',
|
|
332
|
+
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
|
|
333
|
+
];
|
|
334
|
+
|
|
335
|
+
for (const img of validImages) {
|
|
336
|
+
const data = { backgroundImage: img };
|
|
337
|
+
const result = await ViewSchema.validate(data);
|
|
338
|
+
expect(result.isValid).toBe(true);
|
|
339
|
+
expect(result.errors).toHaveLength(0);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it('should accept valid gradient values', async () => {
|
|
344
|
+
const validGradients = [
|
|
345
|
+
'linear-gradient(45deg, #ff6b6b, #4ecdc4)',
|
|
346
|
+
'radial-gradient(circle, rgba(63,94,251,1) 0%, rgba(252,70,107,1) 100%)',
|
|
347
|
+
'conic-gradient(from 180deg at 50% 50%, violet, blue, green, yellow, orange, red, violet)'
|
|
348
|
+
];
|
|
349
|
+
|
|
350
|
+
for (const gradient of validGradients) {
|
|
351
|
+
const data = { backgroundGradient: gradient };
|
|
352
|
+
const result = await ViewSchema.validate(data);
|
|
353
|
+
expect(result.isValid).toBe(true);
|
|
354
|
+
expect(result.errors).toHaveLength(0);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('should reject non-string background values', async () => {
|
|
359
|
+
const invalidData = [
|
|
360
|
+
{ background: 123 },
|
|
361
|
+
{ backgroundImage: { url: 'test.jpg' } },
|
|
362
|
+
{ backgroundGradient: ['red', 'blue'] }
|
|
363
|
+
];
|
|
364
|
+
|
|
365
|
+
for (const data of invalidData) {
|
|
366
|
+
const result = await ViewSchema.validate(data);
|
|
367
|
+
expect(result.isValid).toBe(false);
|
|
368
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('should allow all background props to be set together', async () => {
|
|
373
|
+
const data = {
|
|
374
|
+
background: 'primary.main',
|
|
375
|
+
backgroundImage: 'https://example.com/bg.jpg',
|
|
376
|
+
backgroundGradient: 'linear-gradient(45deg, #ff6b6b, #4ecdc4)'
|
|
377
|
+
};
|
|
378
|
+
const result = await ViewSchema.validate(data);
|
|
379
|
+
expect(result.isValid).toBe(true);
|
|
380
|
+
expect(result.errors).toHaveLength(0);
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// ========================================
|
|
385
|
+
// TEXT ALIGNMENT TESTS
|
|
386
|
+
// ========================================
|
|
387
|
+
|
|
388
|
+
describe('Text Alignment', () => {
|
|
389
|
+
const validAlignments = ['left', 'center', 'right', 'justify'];
|
|
390
|
+
|
|
391
|
+
it('should accept all valid text alignment values', async () => {
|
|
392
|
+
for (const alignment of validAlignments) {
|
|
393
|
+
const data = { textAlign: alignment };
|
|
394
|
+
const result = await ViewSchema.validate(data);
|
|
395
|
+
expect(result.isValid).toBe(true);
|
|
396
|
+
expect(result.errors).toHaveLength(0);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
it('should reject invalid text alignment values', async () => {
|
|
401
|
+
const invalidAlignments = ['start', 'end', 'middle', 'top', 'bottom', '', 'invalid'];
|
|
402
|
+
|
|
403
|
+
for (const alignment of invalidAlignments) {
|
|
404
|
+
const data = { textAlign: alignment };
|
|
405
|
+
const result = await ViewSchema.validate(data);
|
|
406
|
+
expect(result.isValid).toBe(false);
|
|
407
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('should reject non-string text alignment values', async () => {
|
|
412
|
+
const data = { textAlign: 1 };
|
|
413
|
+
const result = await ViewSchema.validate(data);
|
|
414
|
+
expect(result.isValid).toBe(false);
|
|
415
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// ========================================
|
|
420
|
+
// HTML ATTRIBUTES & ACCESSIBILITY TESTS
|
|
421
|
+
// ========================================
|
|
422
|
+
|
|
423
|
+
describe('HTML Attributes & Accessibility', () => {
|
|
424
|
+
it('should accept valid HTML id attribute', async () => {
|
|
425
|
+
const validIds = ['unique-id', 'component_1', 'test-123', 'CamelCaseId'];
|
|
426
|
+
|
|
427
|
+
for (const id of validIds) {
|
|
428
|
+
const data = { id };
|
|
429
|
+
const result = await ViewSchema.validate(data);
|
|
430
|
+
expect(result.isValid).toBe(true);
|
|
431
|
+
expect(result.errors).toHaveLength(0);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it('should accept valid ARIA role attribute', async () => {
|
|
436
|
+
const validRoles = ['button', 'navigation', 'main', 'banner', 'contentinfo', 'dialog'];
|
|
437
|
+
|
|
438
|
+
for (const role of validRoles) {
|
|
439
|
+
const data = { role };
|
|
440
|
+
const result = await ViewSchema.validate(data);
|
|
441
|
+
expect(result.isValid).toBe(true);
|
|
442
|
+
expect(result.errors).toHaveLength(0);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it('should accept valid ARIA attributes', async () => {
|
|
447
|
+
const data = {
|
|
448
|
+
'aria-label': 'Click me to submit form',
|
|
449
|
+
'aria-labelledby': 'label-1 label-2',
|
|
450
|
+
'aria-describedby': 'description-1 description-2'
|
|
451
|
+
};
|
|
452
|
+
const result = await ViewSchema.validate(data);
|
|
453
|
+
expect(result.isValid).toBe(true);
|
|
454
|
+
expect(result.errors).toHaveLength(0);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it('should accept valid data-testid attribute', async () => {
|
|
458
|
+
const validTestIds = ['submit-button', 'user_profile', 'navigation-menu', 'test-component-123'];
|
|
459
|
+
|
|
460
|
+
for (const testId of validTestIds) {
|
|
461
|
+
const data = { 'data-testid': testId };
|
|
462
|
+
const result = await ViewSchema.validate(data);
|
|
463
|
+
expect(result.isValid).toBe(true);
|
|
464
|
+
expect(result.errors).toHaveLength(0);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
it('should reject non-string HTML attributes', async () => {
|
|
469
|
+
const invalidData = [
|
|
470
|
+
{ id: 123 },
|
|
471
|
+
{ role: ['button'] },
|
|
472
|
+
{ 'aria-label': { text: 'label' } },
|
|
473
|
+
{ 'data-testid': true }
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
for (const data of invalidData) {
|
|
477
|
+
const result = await ViewSchema.validate(data);
|
|
478
|
+
expect(result.isValid).toBe(false);
|
|
479
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it('should allow all accessibility attributes to be set together', async () => {
|
|
484
|
+
const data = {
|
|
485
|
+
id: 'main-component',
|
|
486
|
+
role: 'main',
|
|
487
|
+
'aria-label': 'Main content area',
|
|
488
|
+
'aria-labelledby': 'header-title',
|
|
489
|
+
'aria-describedby': 'content-description help-text',
|
|
490
|
+
'data-testid': 'main-content-area'
|
|
491
|
+
};
|
|
492
|
+
const result = await ViewSchema.validate(data);
|
|
493
|
+
expect(result.isValid).toBe(true);
|
|
494
|
+
expect(result.errors).toHaveLength(0);
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
// ========================================
|
|
499
|
+
// EVENT HANDLERS TESTS
|
|
500
|
+
// ========================================
|
|
501
|
+
|
|
502
|
+
describe('Event Handlers', () => {
|
|
503
|
+
const eventHandlers = ['onClick', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
|
|
504
|
+
|
|
505
|
+
it('should accept valid JavaScript function strings', async () => {
|
|
506
|
+
const validHandlers = [
|
|
507
|
+
'function(event) { console.log("clicked"); }',
|
|
508
|
+
'(e) => console.log(e.target)',
|
|
509
|
+
'handleClick',
|
|
510
|
+
'this.handleSubmit.bind(this)',
|
|
511
|
+
'function() { alert("Hello"); return false; }'
|
|
512
|
+
];
|
|
513
|
+
|
|
514
|
+
for (const handler of eventHandlers) {
|
|
515
|
+
for (const func of validHandlers) {
|
|
516
|
+
const data = { [handler]: func };
|
|
517
|
+
const result = await ViewSchema.validate(data);
|
|
518
|
+
expect(result.isValid).toBe(true);
|
|
519
|
+
expect(result.errors).toHaveLength(0);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it('should accept empty string handlers', async () => {
|
|
525
|
+
for (const handler of eventHandlers) {
|
|
526
|
+
const data = { [handler]: '' };
|
|
527
|
+
const result = await ViewSchema.validate(data);
|
|
528
|
+
expect(result.isValid).toBe(true);
|
|
529
|
+
expect(result.errors).toHaveLength(0);
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
it('should reject non-string event handlers', async () => {
|
|
534
|
+
const invalidHandlers = [
|
|
535
|
+
123,
|
|
536
|
+
true,
|
|
537
|
+
['function'],
|
|
538
|
+
{ handler: 'onClick' }
|
|
539
|
+
// Note: null and undefined are valid due to @IsOptional decorator
|
|
540
|
+
];
|
|
541
|
+
|
|
542
|
+
for (const handler of eventHandlers) {
|
|
543
|
+
for (const invalidValue of invalidHandlers) {
|
|
544
|
+
const data = { [handler]: invalidValue };
|
|
545
|
+
const result = await ViewSchema.validate(data);
|
|
546
|
+
expect(result.isValid).toBe(false);
|
|
547
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it('should accept null and undefined event handlers due to @IsOptional', async () => {
|
|
553
|
+
for (const handler of eventHandlers) {
|
|
554
|
+
// Test null
|
|
555
|
+
const dataWithNull = { [handler]: null };
|
|
556
|
+
const result1 = await ViewSchema.validate(dataWithNull);
|
|
557
|
+
expect(result1.isValid).toBe(true);
|
|
558
|
+
expect(result1.errors).toHaveLength(0);
|
|
559
|
+
|
|
560
|
+
// Test undefined
|
|
561
|
+
const dataWithUndefined = { [handler]: undefined };
|
|
562
|
+
const result2 = await ViewSchema.validate(dataWithUndefined);
|
|
563
|
+
expect(result2.isValid).toBe(true);
|
|
564
|
+
expect(result2.errors).toHaveLength(0);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
it('should allow all event handlers to be set together', async () => {
|
|
569
|
+
const data = {
|
|
570
|
+
onClick: 'function(e) { handleClick(e); }',
|
|
571
|
+
onMouseEnter: '(e) => setHover(true)',
|
|
572
|
+
onMouseLeave: '(e) => setHover(false)',
|
|
573
|
+
onFocus: 'handleFocus',
|
|
574
|
+
onBlur: 'handleBlur'
|
|
575
|
+
};
|
|
576
|
+
const result = await ViewSchema.validate(data);
|
|
577
|
+
expect(result.isValid).toBe(true);
|
|
578
|
+
expect(result.errors).toHaveLength(0);
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// ========================================
|
|
583
|
+
// INTEGRATION TESTS
|
|
584
|
+
// ========================================
|
|
585
|
+
|
|
586
|
+
describe('Integration Tests', () => {
|
|
587
|
+
it('should create instance with default values from comprehensive data', () => {
|
|
588
|
+
const comprehensiveData = {
|
|
589
|
+
// Grid props
|
|
590
|
+
span: '6',
|
|
591
|
+
xs: '12',
|
|
592
|
+
sm: '8',
|
|
593
|
+
md: '6',
|
|
594
|
+
lg: '4',
|
|
595
|
+
xl: '3',
|
|
596
|
+
|
|
597
|
+
// Styling
|
|
598
|
+
className: 'my-component custom-style',
|
|
599
|
+
sx: '{"color": "primary.main", "fontWeight": "bold"}',
|
|
600
|
+
style: '{"borderRadius": "8px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}',
|
|
601
|
+
|
|
602
|
+
// Dimensions
|
|
603
|
+
width: 'large',
|
|
604
|
+
height: 'medium',
|
|
605
|
+
minWidth: 'small',
|
|
606
|
+
maxHeight: '500px',
|
|
607
|
+
|
|
608
|
+
// Spacing
|
|
609
|
+
padding: 'medium',
|
|
610
|
+
paddingX: 'large',
|
|
611
|
+
margin: 'small',
|
|
612
|
+
marginY: 'tiny',
|
|
613
|
+
|
|
614
|
+
// Background
|
|
615
|
+
background: 'primary.light',
|
|
616
|
+
backgroundImage: 'https://example.com/bg.jpg',
|
|
617
|
+
backgroundGradient: 'linear-gradient(45deg, #ff6b6b, #4ecdc4)',
|
|
618
|
+
|
|
619
|
+
// Text alignment
|
|
620
|
+
textAlign: 'center',
|
|
621
|
+
|
|
622
|
+
// HTML attributes
|
|
623
|
+
id: 'comprehensive-component',
|
|
624
|
+
role: 'main',
|
|
625
|
+
'aria-label': 'Comprehensive test component',
|
|
626
|
+
'data-testid': 'integration-test',
|
|
627
|
+
|
|
628
|
+
// Events
|
|
629
|
+
onClick: 'function(e) { console.log("Comprehensive click"); }',
|
|
630
|
+
onFocus: 'handleFocus'
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
const viewModel = ViewSchema.createWithDefaults(comprehensiveData);
|
|
634
|
+
|
|
635
|
+
// Test grid props
|
|
636
|
+
expect(viewModel.span).toBe('6');
|
|
637
|
+
expect(viewModel.xs).toBe('12');
|
|
638
|
+
expect(viewModel.lg).toBe('4');
|
|
639
|
+
|
|
640
|
+
// Test styling
|
|
641
|
+
expect(viewModel.className).toBe('my-component custom-style');
|
|
642
|
+
expect(viewModel.sx).toContain('primary.main');
|
|
643
|
+
|
|
644
|
+
// Test dimensions
|
|
645
|
+
expect(viewModel.width).toBe('large');
|
|
646
|
+
expect(viewModel.height).toBe('medium');
|
|
647
|
+
|
|
648
|
+
// Test spacing
|
|
649
|
+
expect(viewModel.padding).toBe('medium');
|
|
650
|
+
expect(viewModel.marginY).toBe('tiny');
|
|
651
|
+
|
|
652
|
+
// Test background
|
|
653
|
+
expect(viewModel.background).toBe('primary.light');
|
|
654
|
+
expect(viewModel.backgroundImage).toBe('https://example.com/bg.jpg');
|
|
655
|
+
|
|
656
|
+
// Test text alignment
|
|
657
|
+
expect(viewModel.textAlign).toBe('center');
|
|
658
|
+
|
|
659
|
+
// Test HTML attributes
|
|
660
|
+
expect(viewModel.id).toBe('comprehensive-component');
|
|
661
|
+
expect(viewModel.role).toBe('main');
|
|
662
|
+
expect(viewModel['aria-label']).toBe('Comprehensive test component');
|
|
663
|
+
|
|
664
|
+
// Test events
|
|
665
|
+
expect(viewModel.onClick).toBe('function(e) { console.log("Comprehensive click"); }');
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
it('should validate comprehensive data successfully', async () => {
|
|
669
|
+
const comprehensiveData = {
|
|
670
|
+
span: 'auto',
|
|
671
|
+
xs: '12',
|
|
672
|
+
sm: '6',
|
|
673
|
+
md: '4',
|
|
674
|
+
lg: '3',
|
|
675
|
+
xl: '2',
|
|
676
|
+
className: 'test-class',
|
|
677
|
+
sx: '{"theme": "dark"}',
|
|
678
|
+
style: '{"color": "red"}',
|
|
679
|
+
width: 'medium',
|
|
680
|
+
height: '300px',
|
|
681
|
+
minWidth: 'small',
|
|
682
|
+
maxWidth: 'large',
|
|
683
|
+
padding: 'medium',
|
|
684
|
+
paddingTop: 'large',
|
|
685
|
+
margin: 'small',
|
|
686
|
+
marginX: 'tiny',
|
|
687
|
+
background: '#ffffff',
|
|
688
|
+
backgroundImage: 'https://test.jpg',
|
|
689
|
+
backgroundGradient: 'linear-gradient(red, blue)',
|
|
690
|
+
textAlign: 'center',
|
|
691
|
+
id: 'test-component',
|
|
692
|
+
role: 'button',
|
|
693
|
+
'aria-label': 'Test button',
|
|
694
|
+
'data-testid': 'test-btn',
|
|
695
|
+
onClick: 'handleClick',
|
|
696
|
+
onFocus: 'handleFocus'
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
const result = await ViewSchema.validate(comprehensiveData);
|
|
700
|
+
expect(result.isValid).toBe(true);
|
|
701
|
+
expect(result.errors).toHaveLength(0);
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
it('should handle mixed valid and invalid data correctly', async () => {
|
|
705
|
+
const mixedData = {
|
|
706
|
+
span: 'auto', // valid
|
|
707
|
+
xs: '13', // invalid - out of range
|
|
708
|
+
className: 'valid-class', // valid
|
|
709
|
+
padding: 'invalid-size', // invalid - not in allowed values
|
|
710
|
+
textAlign: 'center', // valid
|
|
711
|
+
id: 'valid-id', // valid
|
|
712
|
+
onClick: 123 // invalid - not a string
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
const result = await ViewSchema.validate(mixedData);
|
|
716
|
+
expect(result.isValid).toBe(false);
|
|
717
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
718
|
+
|
|
719
|
+
// Should have errors for xs, padding, and onClick
|
|
720
|
+
const errorFields = result.validationErrors?.map(error => error.property) || [];
|
|
721
|
+
expect(errorFields).toContain('xs');
|
|
722
|
+
expect(errorFields).toContain('padding');
|
|
723
|
+
expect(errorFields).toContain('onClick');
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// ========================================
|
|
728
|
+
// EDGE CASES AND ERROR SCENARIOS
|
|
729
|
+
// ========================================
|
|
730
|
+
|
|
731
|
+
describe('Edge Cases and Error Scenarios', () => {
|
|
732
|
+
it('should handle null and undefined values appropriately', async () => {
|
|
733
|
+
// Test with null values - @IsOptional allows null values
|
|
734
|
+
const dataWithNull = {
|
|
735
|
+
className: null,
|
|
736
|
+
padding: null
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const result = await ViewSchema.validate(dataWithNull);
|
|
740
|
+
expect(result.isValid).toBe(true);
|
|
741
|
+
expect(result.errors).toHaveLength(0);
|
|
742
|
+
|
|
743
|
+
// Test undefined values should also be valid due to @IsOptional
|
|
744
|
+
const dataWithUndefined = {
|
|
745
|
+
className: undefined,
|
|
746
|
+
span: undefined,
|
|
747
|
+
padding: undefined
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
const result2 = await ViewSchema.validate(dataWithUndefined);
|
|
751
|
+
expect(result2.isValid).toBe(true);
|
|
752
|
+
expect(result2.errors).toHaveLength(0);
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
it('should reject objects where strings are expected', async () => {
|
|
756
|
+
const invalidData = {
|
|
757
|
+
className: { name: 'class' },
|
|
758
|
+
span: { value: '6' },
|
|
759
|
+
onClick: { handler: 'click' }
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const result = await ViewSchema.validate(invalidData);
|
|
763
|
+
expect(result.isValid).toBe(false);
|
|
764
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
it('should reject arrays where strings are expected', async () => {
|
|
768
|
+
const invalidData = {
|
|
769
|
+
className: ['class1', 'class2'],
|
|
770
|
+
padding: ['small', 'medium'],
|
|
771
|
+
textAlign: ['left', 'center']
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
const result = await ViewSchema.validate(invalidData);
|
|
775
|
+
expect(result.isValid).toBe(false);
|
|
776
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
it('should handle very long strings', async () => {
|
|
780
|
+
const longString = 'a'.repeat(10000);
|
|
781
|
+
const data = {
|
|
782
|
+
className: longString,
|
|
783
|
+
'aria-label': longString,
|
|
784
|
+
onClick: `function() { console.log("${longString}"); }`
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
const result = await ViewSchema.validate(data);
|
|
788
|
+
expect(result.isValid).toBe(true);
|
|
789
|
+
expect(result.errors).toHaveLength(0);
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
it('should handle special characters in string fields', async () => {
|
|
793
|
+
const data = {
|
|
794
|
+
className: 'class-with-special_chars@123',
|
|
795
|
+
id: 'id_with$pecial&chars',
|
|
796
|
+
'aria-label': 'Label with émojis 🚀 and unicode ñ',
|
|
797
|
+
onClick: 'function() { alert("Special chars: !@#$%^&*()"); }'
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
const result = await ViewSchema.validate(data);
|
|
801
|
+
expect(result.isValid).toBe(true);
|
|
802
|
+
expect(result.errors).toHaveLength(0);
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
});
|