diff --git a/.eslintrc.json b/.eslintrc.json index cf81c07acc..3dfe675446 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -195,30 +195,6 @@ "plugin:react/recommended" ] }, - { - "files": [ - "*.vue" - ], - "parserOptions": { - "ecmaFeatures": { - "jsx": false - } - }, - "plugins": [ - "@typescript-eslint", - "vue" - ], - "extends": [ - "plugin:vue/essential", - "eslint:recommended", - "@vue/eslint-config-typescript" - ], - "rules": { - "no-extra-boolean-cast": "off", - "vue/no-use-v-if-with-v-for": "off", - "vue/multi-word-component-names": "off" - } - }, { "files": [ "*.js" diff --git a/.testcaferc.dev.js b/.testcaferc.dev.js index 6dc8b1952b..b07ad52cc4 100644 --- a/.testcaferc.dev.js +++ b/.testcaferc.dev.js @@ -1,5 +1,5 @@ module.exports = { - "browsers": [`chrome:${require("puppeteer").executablePath()}`], + "browsers": [`chrome:${require("puppeteer").executablePath()} --window-size=1920,1080`], "nativeAutomation": "true", } \ No newline at end of file diff --git a/.testcaferc.js b/.testcaferc.js index d98ed03cf9..570716918e 100644 --- a/.testcaferc.js +++ b/.testcaferc.js @@ -1,7 +1,7 @@ module.exports = { - "browsers": [`chrome:${require("puppeteer").executablePath()}:headless`], + "browsers": [`chrome:${require("puppeteer").executablePath()}:headless --window-size=1920,1080`], "nativeAutomation": "true", "concurrency": 4, "quarantineMode": { diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b3b1d54c..02b9eaf601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.12.17](https://github.com/surveyjs/survey-library/compare/v1.12.16...v1.12.17) (2024-12-30) + ## [1.12.16](https://github.com/surveyjs/survey-library/compare/v1.12.15...v1.12.16) (2024-12-24) ## [1.12.15](https://github.com/surveyjs/survey-library/compare/v1.12.14...v1.12.15) (2024-12-17) diff --git a/accessibility-tests.yml b/accessibility-tests.yml index 27fd6a9e96..1c2d13145b 100644 --- a/accessibility-tests.yml +++ b/accessibility-tests.yml @@ -3,394 +3,343 @@ # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript - trigger: batch: true branches: include: - - master + - master tags: exclude: - v*.*.* pool: - vmImage: 'windows-latest' + vmImage: "windows-latest" jobs: -- job: Knockout - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_knockout_prod - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:knockout - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Knockout_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Knockout_AXE/' - ArtifactName: 'Library_Knockout_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: React - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_react_prod - npm run build_core - npm run build_react_ui - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:react - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_React_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_React_AXE/' - ArtifactName: 'Library_React_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Vue - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_vue_prod - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:vue - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue_AXE/' - ArtifactName: 'Library_Vue_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Angular - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-angular-ui - npm install - displayName: "NPM install packages/survey-angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build - displayName: "Build Angular" - - - script: | - cd packages/survey-angular-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build:example - displayName: "Build Angular Example" - - - script: | - npm run accessibility-tests:ci:angular - displayName: "run accessibility tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Angular_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Angular_AXE/' - ArtifactName: 'Library_Angular_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Vue3 - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-vue3-ui - npm install - displayName: "NPM install packages/survey-vue3-ui" - - - script: | - cd packages/survey-vue3-ui - npm run build - displayName: "Build Vue3" - - - script: | - cd packages/survey-vue3-ui/example - npm install - displayName: "NPM install Vue3 example" - - - script: | - cd packages/survey-vue3-ui/example - npm run build - displayName: "Build Vue3 Example" - - - script: | - npm run accessibility-tests:ci:vue3 - displayName: "run accessibility tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue3_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue3_AXE/' - ArtifactName: 'Library_Vue3_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' \ No newline at end of file + - job: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npm run lint + displayName: "run lint command" + + - script: | + cd packages/survey-core + npm install + displayName: "NPM install packages/survey-core" + + - script: | + cd packages/survey-core + npm run build:all + displayName: "Build core" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core" + ArtifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + publishLocation: "Container" + + - job: React + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-react-ui + npm install + displayName: "NPM install packages/survey-react-ui" + + - script: | + cd packages/survey-react-ui + npm run build + displayName: "Build React" + + - script: | + cd packages/survey-react-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: Angular + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-angular-ui + npm install + displayName: "NPM install packages/survey-angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build + displayName: "Build Angular" + + - script: | + cd packages/survey-angular-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build:example:prod + displayName: "Build Angular Example" + + - script: | + cd packages/survey-angular-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: Vue3 + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-vue3-ui + npm install + displayName: "NPM install packages/survey-vue3-ui" + + - script: | + cd packages/survey-vue3-ui + npm run build + displayName: "Build Vue3" + + - script: | + cd packages/survey-vue3-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-vue3-ui/example + npm run build + displayName: "Build Vue3 Example" + + - script: | + cd packages/survey-vue3-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: SurveyUI_and_CSSFrameworks + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory) + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-js-ui + npm install + displayName: "NPM install packages/survey-js-ui" + + - script: | + cd packages/survey-js-ui + npm run build + displayName: "Build UI" + + - script: | + cd packages/survey-js-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" diff --git a/accessibilityTests/helper.ts b/accessibilityTests/helper.ts index 29ecd7d2d6..57b0c2cb90 100644 --- a/accessibilityTests/helper.ts +++ b/accessibilityTests/helper.ts @@ -9,15 +9,11 @@ const environment = args.env; export const frameworks = environment ? [environment] : ["knockout", "react", "vue"]; -export const url = "http://127.0.0.1:8080/examples_test/default/"; +export const url = "http://127.0.0.1:8080/examples_test/defaultV2/"; export const urlV2 = "http://127.0.0.1:8080/examples_test/defaultV2/"; export const url_test = "http://127.0.0.1:8080/examples_test/"; export const FLOAT_PRECISION = 0.01; -export const applyTheme = ClientFunction((theme) => { - window["Survey"].StylesManager.applyTheme(theme); -}); - export const initSurvey = ClientFunction( (framework, json, events?, isDesignMode?, props?) => { // eslint-disable-next-line no-console @@ -72,6 +68,9 @@ export const initSurvey = ClientFunction( el: "#surveyElement", data: { survey: model }, }); + } else if (framework === "survey-js-ui") { + document.getElementById("surveyElement").innerHTML = ""; + (window as any).SurveyUI.renderSurvey(model, document.getElementById("surveyElement")); } else if (framework === "angular" || framework == "vue3") { (window as any).setSurvey(model); } @@ -82,7 +81,7 @@ export const initSurvey = ClientFunction( // https://www.deque.com/axe/core-documentation/api-documentation/#overview export const axeTags = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "best-practice", "section508", "wcag412"]; -export const axeContext = { include: [[".sv_p_root"]] }; +export const axeContext = { include: [[".sd-page"]] }; export const axeOptions = { runOnly: { type: "tag", diff --git a/build-packages.yml b/build-packages.yml index 6d0923c18d..86f6656913 100644 --- a/build-packages.yml +++ b/build-packages.yml @@ -17,7 +17,6 @@ resources: variables: npm_config_cache: $(Pipeline.Workspace)/.npm - trigger: batch: true branches: @@ -31,969 +30,676 @@ pool: vmImage: ubuntu-latest jobs: - -- job: NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - -- job: CoreAngularJquery - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: Service - persistCredentials: true - clean: true - fetchDepth: 1 - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run doc_gen - displayName: "generate docs" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/docs" - Contents: | - classes.json - pmes.json - surveyjs_definition.json - TargetFolder: "$(Build.SourcesDirectory)/service/surveyjs.io/App_Data/DocsLibrary" - OverWrite: true - CleanTargetFolder: false - displayName: "copy generated docs to the local surveyjs/service repo" - - # read about the problem with git output ($env:GIT_REDIRECT_STDERR = '2>&1') : - # https://github.com/microsoft/azure-pipelines-yaml/issues/248 - # https://stackoverflow.com/questions/58485585/azure-pipeline-powershell-and-git-on-windows-server-2019-gives-error-in-output - - powershell: | - cd $(Build.SourcesDirectory)/service - $env:GIT_REDIRECT_STDERR = '2>&1' - git config --global user.email "kurmanov.work@gmail.com" - git config --global user.name "dmitrykurmanov" - git pull origin master - git fetch origin master --tags --force - git checkout master - git add surveyjs.io/App_Data/DocsLibrary - git commit -m "updated survey-library docs [azurepipelines skip]" - git pull origin master - git push origin master - displayName: "git surveyjs/service push updated docs" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_angular - displayName: "Build Angular" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_jquery - displayName: "Build jQuery" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-core" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-core" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-angular" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-angular" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-jquery" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-jquery" - - #trigger next build via the artifact file 'version.txt' - - task: CopyFiles@2 - inputs: - contents: "version.txt" - targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild - displayName: "copy version file to Build.ArtifactStagingDirectory" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildCoreAngularJquery" - publishLocation: "Container" - -- job: Knockout - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_knockout - displayName: "Build Knockout" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_knockout_ui - displayName: "Build Knockout UI" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run test:postcss - displayName: "check postcss compatibility" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testsingle - displayName: "run unit tests" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:ko - displayName: "run functional tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-knockout" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-knockout" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-knockout-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-knockout-ui" - - #trigger next build via the artifact file 'version.txt' - - task: CopyFiles@2 - inputs: - contents: "version.txt" - targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild - displayName: "copy version file to Build.ArtifactStagingDirectory" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildKnockout" - publishLocation: "Container" - -- job: React - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_react - displayName: "Build React" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_react_ui - displayName: "Build React UI" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:react - displayName: "run functional tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-react" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-react" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-react-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-react-ui" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildReact" - publishLocation: "Container" - -- job: Vue - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_vue - displayName: "Build Vue" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_vue_ui - displayName: "Build Vue UI" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:vue - displayName: "Vue functional tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-vue" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-vue" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-vue-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-vue-ui" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildVue" - publishLocation: "Container" - -- job: Angular - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui - npm install - displayName: "NPM install packages/survey-angular-ui" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui - npm run build - displayName: "Build Angular" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui - npm run build:example - displayName: "Build Angular Example" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui - npm run test:single - displayName: "run unit and markup tests" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:ci:angular - displayName: "run functional tests" - - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-angular-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-angular-ui" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildAngular" - publishLocation: "Container" - -- job: Vue3 - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui - npm install - displayName: "NPM install packages/survey-vue3-ui" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui - npm run build - displayName: "Build Vue3" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui/example - npm install - displayName: "NPM install survey-vue3-ui/example" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui/example - npm run build - displayName: "Build Vue3 Example" - - - script: | - cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui - npm run test:single - displayName: "run unit and markup tests" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:ci:vue3 - displayName: "run functional tests" - - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-vue3-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-vue3-ui" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildVue3" - publishLocation: "Container" - -# - job: JqueryUI -# dependsOn: -# - NPMCache - -# steps: -# - checkout: self -# - checkout: EmptyRepo -# persistCredentials: true -# clean: true - -# - task: NodeTool@0 -# inputs: -# versionSpec: "16.x" -# displayName: "Install Node.js" - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: "$(Build.SourcesDirectory)/survey-library/" -# Contents: "package.json" -# TargetFolder: "$(Build.SourcesDirectory)/Temp/" -# OverWrite: true -# displayName: "Copy package.json for cache key" -# - task: Cache@2 -# inputs: -# key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' -# path: $(Build.SourcesDirectory)/survey-library/node_modules -# cacheHitVar: NPM_CACHE_RESTORED -# displayName: Cache NPM - -# # setup next release version -# - task: DownloadBuildArtifacts@0 -# inputs: -# buildType: "specific" -# project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" -# pipeline: "47" -# buildVersionToDownload: "latest" -# downloadType: "single" -# artifactName: "ReleaseVersionFile" -# downloadPath: "$(System.ArtifactsDirectory)" - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" -# Contents: "version.txt" -# TargetFolder: "$(Build.SourcesDirectory)/" -# OverWrite: true -# displayName: "Copy Build Artifact - SurveyJSVersion File" - -# - powershell: | -# $version = Get-Content $(Build.SourcesDirectory)/version.txt -# Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" -# displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" -# ########################################################################## - -# - task: Npm@1 -# displayName: 'NPM install' -# inputs: -# command: install -# verbose: false -# workingDir: $(Build.SourcesDirectory)/survey-library -# condition: ne(variables.NPM_CACHE_RESTORED, 'true') - -# - script: | -# cd $(Build.SourcesDirectory)/survey-library -# npm run release -- --release-as $(SurveyJSVersion) -# git status -# displayName: "npm run release" - -# - script: | -# cd $(Build.SourcesDirectory)/survey-library -# npm run build_core -# npm run build_i18n -# npm run build-plugins -# displayName: "Build Core" - -# - script: | -# cd $(Build.SourcesDirectory)/survey-library -# npm run build_jquery_ui -# displayName: "Build jquery-ui" - -# - script: | -# cd $(Build.SourcesDirectory)/survey-library -# npm run testcafe:jquery-ui:ci -# displayName: "run functional tests" - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-jquery-ui" -# TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-jquery-ui" - -# - task: PublishBuildArtifacts@1 -# inputs: -# PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" -# ArtifactName: "SurveyJSLibraryBuildJQueryUI" -# publishLocation: "Container" - -- job: SurveyUI_and_CSSFrameworks - dependsOn: - - NPMCache - - steps: - - checkout: self - - checkout: EmptyRepo - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/survey-library/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - # setup next release version - - task: DownloadBuildArtifacts@0 - inputs: - buildType: "specific" - project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" - pipeline: "47" - buildVersionToDownload: "latest" - downloadType: "single" - artifactName: "ReleaseVersionFile" - downloadPath: "$(System.ArtifactsDirectory)" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" - Contents: "version.txt" - TargetFolder: "$(Build.SourcesDirectory)/" - OverWrite: true - displayName: "Copy Build Artifact - SurveyJSVersion File" - - - powershell: | - $version = Get-Content $(Build.SourcesDirectory)/version.txt - Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" - displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" - ########################################################################## - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory)/survey-library - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run release -- --release-as $(SurveyJSVersion) - git status - displayName: "npm run release" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run build_js_ui - displayName: "Build survey-js-ui" - - - script: | - cd $(Build.SourcesDirectory)/survey-library - npm run testcafe:survey-js-ui:ci - displayName: "run functional tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/survey-library/build/survey-js-ui" - TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-js-ui" - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" - ArtifactName: "SurveyJSLibraryBuildSurveyUI" - publishLocation: "Container" + - job: NPMCache + + steps: + - checkout: self + - checkout: EmptyRepo + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + - task: Npm@1 + displayName: "NPM install" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - job: Core + dependsOn: + - NPMCache + + steps: + - checkout: self + - checkout: Service + persistCredentials: true + clean: true + fetchDepth: 1 + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + # setup next release version + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "specific" + project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" + pipeline: "47" + buildVersionToDownload: "latest" + downloadType: "single" + artifactName: "ReleaseVersionFile" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" + Contents: "version.txt" + TargetFolder: "$(Build.SourcesDirectory)/" + OverWrite: true + displayName: "Copy Build Artifact - SurveyJSVersion File" + + - powershell: | + $version = Get-Content $(Build.SourcesDirectory)/version.txt + Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" + displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" + ########################################################################## + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + cd $(Build.SourcesDirectory)/survey-library + npm run lint + displayName: "run lint command" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm install + displayName: "NPM install packages/survey-core" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm run release -- --release-as $(SurveyJSVersion) + git status + displayName: "npm run release" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm run build:all + displayName: "Build Core" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm test + displayName: "run unit test" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm run test:postcss + displayName: "check postcss compatibility" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-core + npm run doc_gen + displayName: "generate docs" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/docs" + Contents: | + classes.json + pmes.json + surveyjs_definition.json + TargetFolder: "$(Build.SourcesDirectory)/service/surveyjs.io/App_Data/DocsLibrary" + OverWrite: true + CleanTargetFolder: false + displayName: "copy generated docs to the local surveyjs/service repo" + + # read about the problem with git output ($env:GIT_REDIRECT_STDERR = '2>&1') : + # https://github.com/microsoft/azure-pipelines-yaml/issues/248 + # https://stackoverflow.com/questions/58485585/azure-pipeline-powershell-and-git-on-windows-server-2019-gives-error-in-output + - powershell: | + cd $(Build.SourcesDirectory)/service + $env:GIT_REDIRECT_STDERR = '2>&1' + git config --global user.email "kurmanov.work@gmail.com" + git config --global user.name "dmitrykurmanov" + git pull origin master + git fetch origin master --tags --force + git checkout master + git add surveyjs.io/App_Data/DocsLibrary + git commit -m "updated survey-library docs [azurepipelines skip]" + git pull origin master + git push origin master + displayName: "git surveyjs/service push updated docs" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/build" + TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-core" + + #trigger next build via the artifact file 'version.txt' + - task: CopyFiles@2 + inputs: + contents: "version.txt" + targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild + displayName: "copy version file to Build.ArtifactStagingDirectory" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-core" + ArtifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + publishLocation: "Container" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" + ArtifactName: "SurveyJSLibraryBuildCore" + publishLocation: "Container" + + - job: React + dependsOn: + - Core + + steps: + - checkout: self + - checkout: EmptyRepo + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + # setup next release version + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "specific" + project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" + pipeline: "47" + buildVersionToDownload: "latest" + downloadType: "single" + artifactName: "ReleaseVersionFile" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" + Contents: "version.txt" + TargetFolder: "$(Build.SourcesDirectory)/" + OverWrite: true + displayName: "Copy Build Artifact - SurveyJSVersion File" + + - powershell: | + $version = Get-Content $(Build.SourcesDirectory)/version.txt + Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" + displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" + ########################################################################## + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + cd $(Build.SourcesDirectory)/survey-library + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/build" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-react-ui + npm install + displayName: "NPM install packages/survey-react-ui" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-react-ui + npm run release -- --release-as $(SurveyJSVersion) + git status + displayName: "npm run release" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-react-ui + npm run build + displayName: "Build React UI" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-react-ui + npm run test + displayName: "run markup tests" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-react-ui + npm run testcafe:ci + displayName: "run functional tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-react-ui/build" + TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-react-ui" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" + ArtifactName: "SurveyJSLibraryBuildReact" + publishLocation: "Container" + + - job: Angular + dependsOn: + - Core + + steps: + - checkout: self + - checkout: EmptyRepo + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + # setup next release version + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "specific" + project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" + pipeline: "47" + buildVersionToDownload: "latest" + downloadType: "single" + artifactName: "ReleaseVersionFile" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" + Contents: "version.txt" + TargetFolder: "$(Build.SourcesDirectory)/" + OverWrite: true + displayName: "Copy Build Artifact - SurveyJSVersion File" + + - powershell: | + $version = Get-Content $(Build.SourcesDirectory)/version.txt + Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" + displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" + ########################################################################## + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + cd $(Build.SourcesDirectory)/survey-library + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/build" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm install + displayName: "NPM install packages/survey-angular-ui" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm run release -- --release-as $(SurveyJSVersion) + git status + displayName: "npm run release" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm run build + displayName: "Build Angular" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm run build:example:prod + displayName: "Build Angular Example" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm run test + displayName: "run unit and markup tests" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui + npm run testcafe:ci + displayName: "run functional tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-angular-ui/build" + TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-angular-ui" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" + ArtifactName: "SurveyJSLibraryBuildAngular" + publishLocation: "Container" + + - job: Vue3 + dependsOn: + - Core + + steps: + - checkout: self + - checkout: EmptyRepo + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + # setup next release version + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "specific" + project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" + pipeline: "47" + buildVersionToDownload: "latest" + downloadType: "single" + artifactName: "ReleaseVersionFile" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" + Contents: "version.txt" + TargetFolder: "$(Build.SourcesDirectory)/" + OverWrite: true + displayName: "Copy Build Artifact - SurveyJSVersion File" + + - powershell: | + $version = Get-Content $(Build.SourcesDirectory)/version.txt + Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" + displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" + ########################################################################## + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + cd $(Build.SourcesDirectory)/survey-library + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/build" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui + npm install + displayName: "NPM install packages/survey-vue3-ui" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui + npm run release -- --release-as $(SurveyJSVersion) + git status + displayName: "npm run release" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui + npm run build + displayName: "Build Vue3" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui/example + npm install + displayName: "NPM install survey-vue3-ui/example" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui/example + npm run build + displayName: "Build Vue3 Example" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui + npm run test + displayName: "run unit and markup tests" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui + npm run testcafe:ci + displayName: "run functional tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-vue3-ui/build" + TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-vue3-ui" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" + ArtifactName: "SurveyJSLibraryBuildVue3" + publishLocation: "Container" + + - job: SurveyUI_and_CSSFrameworks + dependsOn: + - Core + + steps: + - checkout: self + - checkout: EmptyRepo + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/survey-library/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + # setup next release version + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "specific" + project: "af2804d2-859a-4705-9ef5-cdf46d1d5d4f" + pipeline: "47" + buildVersionToDownload: "latest" + downloadType: "single" + artifactName: "ReleaseVersionFile" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(System.ArtifactsDirectory)/ReleaseVersionFile/" + Contents: "version.txt" + TargetFolder: "$(Build.SourcesDirectory)/" + OverWrite: true + displayName: "Copy Build Artifact - SurveyJSVersion File" + + - powershell: | + $version = Get-Content $(Build.SourcesDirectory)/version.txt + Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" + displayName: "setup SurveyJSVersion variable from SurveyJSVersionFile" + ########################################################################## + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory)/survey-library + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + cd $(Build.SourcesDirectory)/survey-library + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-core/build" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-js-ui + npm install + displayName: "NPM install packages/survey-js-ui" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-js-ui + npm run release -- --release-as $(SurveyJSVersion) + git status + displayName: "npm run release" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-js-ui + npm run build + displayName: "Build UI" + + # - script: | + # cd $(Build.SourcesDirectory)/survey-library/packages/survey-js-ui + # npm run test + # displayName: "run markup tests" + + - script: | + cd $(Build.SourcesDirectory)/survey-library/packages/survey-js-ui + npm run testcafe:ci + displayName: "run functional tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/survey-library/packages/survey-js-ui/build" + TargetFolder: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/packages/survey-js-ui" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/" + ArtifactName: "SurveyJSLibraryBuildSurveyUI" + publishLocation: "Container" diff --git a/build-scripts/karma.conf.js b/build-scripts/karma.conf.js deleted file mode 100644 index e383fd424e..0000000000 --- a/build-scripts/karma.conf.js +++ /dev/null @@ -1,76 +0,0 @@ -var path = require("path"); -var webpack = require("webpack"); -var webpackConfigCreator = require("./webpack.common"); -var packageJson = require("../package.json"); -const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); -var webpackConfig = webpackConfigCreator({ - platform: "knockout", - buildType: "dev", -}, - packageJson -); - -//process.env.CHROME_BIN = require("puppeteer").executablePath(); - -/*setup ts config file for tests ("noImplicitAny": false)*/ -webpackConfig.resolve.plugins[0] = new TsconfigPathsPlugin({ configFile: path.resolve(__dirname, "./tsconfig.tests.json") }) -webpackConfig.module.rules[0].options.configFile = "build-scripts/tsconfig.tests.json"; - -module.exports = function (config) { - config.set({ - basePath: "../", - frameworks: ["qunit"], - files: ["tests/entries/*.ts"], - exclude: [], - mime: { - "text/x-typescript": ["ts", "tsx"] - }, - captureTimeout: 210000, - browserDisconnectTimeout: 100000, - browserDisconnectTolerance: 3, - browserNoActivityTimeout: 100000, - junitReporter: { - outputDir: "tmp/testresults/", - outputFile: "test-results.xml" - }, - preprocessors: { - "**/*.ts": ["webpack", "sourcemap"] - }, - webpack: { - module: webpackConfig.module, - resolve: webpackConfig.resolve, - plugins: webpackConfig.plugins.concat([ - new webpack.SourceMapDevToolPlugin({ - filename: null, // if no value is provided the sourcemap is inlined - test: /\.(ts|js)($|\?)/i // process .js and .ts files only - }) - ]) - }, - reporters: ["progress", "dots", "junit"], - browsers: ["ChromeHeadlessNoSandbox"], - customLaunchers: { - ChromeHeadlessNoSandbox: { - base: 'ChromeHeadless', - flags: [ - '--no-sandbox', - '--disable-gpu', - '--no-default-browser-check', - '--no-first-run', - '--disable-default-apps', - '--disable-popup-blocking', - '--disable-translate', - '--disable-background-timer-throttling', - '--disable-renderer-backgrounding', - '--disable-device-discovery-notifications', - '--disable-web-security' - ] - } - }, - colors: true, - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_WARN, - autoWatch: true, - singleRun: false, - concurrency: Infinity - }); -}; diff --git a/build-scripts/survey-angular/README.md b/build-scripts/survey-angular/README.md deleted file mode 100644 index 4ee46524e0..0000000000 --- a/build-scripts/survey-angular/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# SurveyJS Form Library for Angular - - - - - -SurveyJS Form Library is a free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your web applications. - -> **NOTE**: This package contains a legacy Knockout-dependent version of SurveyJS Form Library for Angular. -> -> In Angular v12+ applications, we recommend using a new [native implementation of SurveyJS Angular Form Library](https://www.npmjs.com/package/survey-angular-ui). For information on how to integrate it into your application, refer to the following tutorial: [Add a Survey to an Angular Application](https://surveyjs.io/form-library/documentation/get-started-angular). -> -> With earlier Angular versions, you can use this obsolete package. Refer to the following code examples on GitHub for more information: -> - [Add SurveyJS Form Library to an Angular v8–v11 Application](https://github.com/surveyjs/code-examples/tree/main/legacy-angular/form-library) -> - [Add Survey Creator to an Angular v8–v11 Application](https://github.com/surveyjs/code-examples/tree/main/legacy-angular/survey-creator) - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/angular) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Form Library for Angular from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-angular/package.json b/build-scripts/survey-angular/package.json deleted file mode 100644 index db6790ca47..0000000000 --- a/build-scripts/survey-angular/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "survey-angular", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "angular", - "angular-component" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey.angular.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey.angular.d.ts", - "typesVersions": { - "<4.2": { - "*": [ - "ts3.4/*" - ] - } - }, - "dependencies": {} -} \ No newline at end of file diff --git a/build-scripts/survey-angular/tsconfig.json b/build-scripts/survey-angular/tsconfig.json deleted file mode 100644 index 02fa849770..0000000000 --- a/build-scripts/survey-angular/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions:": { - "baseUrl": ".", - "paths": { - "survey-core": ["../../src/entries/core.ts"], - } - } -} diff --git a/build-scripts/survey-angular/tsconfig.typing.angular.json b/build-scripts/survey-angular/tsconfig.typing.angular.json deleted file mode 100644 index cfb849c858..0000000000 --- a/build-scripts/survey-angular/tsconfig.typing.angular.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../../packages/survey-core/src/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/angular.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-angular/webpack.config.js b/build-scripts/survey-angular/webpack.config.js deleted file mode 100644 index f88eeb980e..0000000000 --- a/build-scripts/survey-angular/webpack.config.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss") - }, - externals: { - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-angular/tsconfig.typing.angular.json", - filePath: "build/survey-angular/survey.angular.d.ts", - moduleName: "survey-angular", - importName: "src/entries/angular" - }), - ], -}; - -module.exports = function (options) { - options.platform = "angular"; - options.libraryName = "Survey"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey.angular"), config); -} diff --git a/build-scripts/survey-core/README.md b/build-scripts/survey-core/README.md deleted file mode 100644 index 483c0631d7..0000000000 --- a/build-scripts/survey-core/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Survey Model (Platform-Independent Part) - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A platform-independent survey model for SurveyJS Form Library. This package should be used with one of platform-specific UI rendering packages. Refer to the following Get Started tutorials for more information: - -- [Angular](https://surveyjs.io/Documentation/Library?id=get-started-angular) -- [React](https://surveyjs.io/Documentation/Library?id=get-started-react) -- [Vue](https://surveyjs.io/Documentation/Library?id=get-started-vue) -- [HTML/CSS/JavaScript](https://surveyjs.io/form-library/documentation/get-started-html-css-javascript) - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/Examples/Library) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build Survey Model from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-core/package.json b/build-scripts/survey-core/package.json deleted file mode 100644 index f347a90cc9..0000000000 --- a/build-scripts/survey-core/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "survey-core", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "survey", - "library" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey.core.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "./typings/src/entries/core.d.ts", - "typesVersions": { - "<4.2": { - "*": [ - "ts3.4/*" - ] - } - }, - "dependencies": {} -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.i18n.json b/build-scripts/survey-core/tsconfig.i18n.json deleted file mode 100644 index 283f332e16..0000000000 --- a/build-scripts/survey-core/tsconfig.i18n.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "declaration": false, - "declarationDir": null, - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - }, - "include": [ - "../../src/entries/i18n.ts" - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.icons.json b/build-scripts/survey-core/tsconfig.icons.json deleted file mode 100644 index f8979f0bad..0000000000 --- a/build-scripts/survey-core/tsconfig.icons.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-core/icons/" - }, - "include": [ - "../../packages/survey-core/src/iconsV1.ts", - "../../packages/survey-core/src/iconsV2.ts", - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.json b/build-scripts/survey-core/tsconfig.json deleted file mode 100644 index 1573b2c125..0000000000 --- a/build-scripts/survey-core/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "declarationDir": "../../build/survey-core/typings" - }, - "include": [ - "../../src/entries/core.ts" - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.plugins.bootstrap.json b/build-scripts/survey-core/tsconfig.plugins.bootstrap.json deleted file mode 100644 index e54410716a..0000000000 --- a/build-scripts/survey-core/tsconfig.plugins.bootstrap.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-core/plugins" - }, - "include": [ - "../../src/plugins/themes/bootstrap-integration/index.ts" - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.plugins.bootstrapmaterial.json b/build-scripts/survey-core/tsconfig.plugins.bootstrapmaterial.json deleted file mode 100644 index 098f06e715..0000000000 --- a/build-scripts/survey-core/tsconfig.plugins.bootstrapmaterial.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-core/plugins" - }, - "include": [ - "../../src/plugins/themes/bootstrap-material-integration/index.ts" - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/tsconfig.themes.json b/build-scripts/survey-core/tsconfig.themes.json deleted file mode 100644 index c25dd462b9..0000000000 --- a/build-scripts/survey-core/tsconfig.themes.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-core/themes/" - }, - "include": [ - "../../packages/survey-core/src/themes/index.ts" - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-core/webpack.config.js b/build-scripts/survey-core/webpack.config.js deleted file mode 100644 index 528833c99b..0000000000 --- a/build-scripts/survey-core/webpack.config.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - "modern.fontless": path.resolve(__dirname, "../../src/modern.fontless.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss"), - "defaultV2.fontless": path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.fontless.scss") - }, - plugins: [ - new FixStyleOnlyEntriesPlugin(), - ], -}; - -module.exports = function (options) { - options.platform = "core"; - options.libraryName = "Survey"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.json") - return merge(webpackCommonConfigCreator(options, packageJson, "survey.core"), config); -}; diff --git a/build-scripts/survey-core/webpack.i18n.js b/build-scripts/survey-core/webpack.i18n.js deleted file mode 100644 index 12af95a08a..0000000000 --- a/build-scripts/survey-core/webpack.i18n.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -const fs = require("fs"); -const path = require("path"); -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); - -const config = { - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; -function patchEntries() { - config.entry = {}; - fs.readdirSync(path.resolve(__dirname, "../../packages/survey-core/src/localization")).forEach(file => { - var extension = path.extname(file); - if (extension.toLowerCase() === ".ts") { - config.entry[path.basename(file, extension)] = (path.resolve(__dirname, "../../packages/survey-core/src/localization") + "/" + file); - } - }); - config.entry.index = path.resolve(__dirname, "../../src/entries/i18n.ts"); -} - -function patchFilename(options) { - config.output = {}; - const isProductionBuild = options.buildType === "prod"; - config.output.filename = (pathData) => { - return (pathData.chunk.name == "survey.i18n" ? "[name]" : "i18n/[name]") + (isProductionBuild ? ".min" : "") + ".js"; - } -} - -module.exports = function (options) { - options.platform = "i18n"; - options.libraryName = "SurveyLocales"; - patchEntries(); - patchFilename(options); - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.i18n.json") - return merge(webpackCommonConfigCreator(options, packageJson, "survey.i18n"), config); -}; - diff --git a/build-scripts/survey-core/webpack.icons.config.js b/build-scripts/survey-core/webpack.icons.config.js deleted file mode 100644 index b0fab92c81..0000000000 --- a/build-scripts/survey-core/webpack.icons.config.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -var path = require("path"); - -const config = { - entry: { - "iconsV1": path.resolve(__dirname, "../../packages/survey-core/src/iconsV1.ts"), - "iconsV2": path.resolve(__dirname, "../../packages/survey-core/src/iconsV2.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyIcons"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.icons.json") - - return merge(webpackCommonConfigCreator(options, { "name": "survey-icons" }, "survey.icons", "survey-core/icons"), config); -}; diff --git a/build-scripts/survey-core/webpack.plugins.bootstrap.config.js b/build-scripts/survey-core/webpack.plugins.bootstrap.config.js deleted file mode 100644 index db4880d3d5..0000000000 --- a/build-scripts/survey-core/webpack.plugins.bootstrap.config.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -var path = require("path"); - -const config = { - entry: { - ["index"]: path.resolve(__dirname, "../../src/plugins/themes/bootstrap-integration/index.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyBootstrap"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.plugins.bootstrap.json") - - return merge(webpackCommonConfigCreator(options, { "name": "survey-plugins" }, "survey.plugins", "survey-core/plugins/bootstrap-integration"), config); -}; diff --git a/build-scripts/survey-core/webpack.plugins.bootstrap.material.config.js b/build-scripts/survey-core/webpack.plugins.bootstrap.material.config.js deleted file mode 100644 index ff821d856a..0000000000 --- a/build-scripts/survey-core/webpack.plugins.bootstrap.material.config.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -var path = require("path"); - -const config = { - entry: { - ["index"]: path.resolve(__dirname, "../../src/plugins/themes/bootstrap-material-integration/index.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyBootstrapMaterial"; - - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.plugins.bootstrapmaterial.json") - - return merge(webpackCommonConfigCreator(options, { "name": "survey-plugins" }, "survey.plugins", "survey-core/plugins/bootstrap-material-integration"), config); -}; diff --git a/build-scripts/survey-core/webpack.themes.config.js b/build-scripts/survey-core/webpack.themes.config.js deleted file mode 100644 index 2b957c4fc0..0000000000 --- a/build-scripts/survey-core/webpack.themes.config.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -var path = require("path"); - -const config = { - entry: { - "default-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light.ts"), - "default-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark.ts"), - "default-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light-panelless.ts"), - "default-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark-panelless.ts"), - "sharp-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light.ts"), - "sharp-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark.ts"), - "sharp-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light-panelless.ts"), - "sharp-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark-panelless.ts"), - "borderless-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light.ts"), - "borderless-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark.ts"), - "borderless-light-panelless.": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light-panelless.ts"), - "borderless-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark-panelless.ts"), - "flat-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light.ts"), - "flat-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark.ts"), - "flat-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light-panelless.ts"), - "flat-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark-panelless.ts"), - "plain-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light.ts"), - "plain-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark.ts"), - "plain-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light-panelless.ts"), - "plain-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark-panelless.ts"), - "doubleborder-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light.ts"), - "doubleborder-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark.ts"), - "doubleborder-light-panelles": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light-panelless.ts"), - "doubleborder-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark-panelless.ts"), - "layered-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light.ts"), - "layered-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark.ts"), - "layered-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light-panelless.ts"), - "layered-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark-panelless.ts"), - "solid-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light.ts"), - "solid-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark.ts"), - "solid-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light-panelless.ts"), - "solid-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark-panelless.ts"), - "three-dimensional-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light.ts"), - "three-dimensional-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark.ts"), - "three-dimensional-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light-panelless.ts"), - "three-dimensional-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark-panelless.ts"), - "contrast-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light.ts"), - "contrast-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark.ts"), - "contrast-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light-panelless.ts"), - "contrast-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark-panelless.ts"), - "index": path.resolve(__dirname, "../../packages/survey-core/src/themes/index.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyTheme"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.themes.json") - - return merge(webpackCommonConfigCreator(options, { "name": "survey-themes" }, "survey.themes", "survey-core/themes"), config); -}; diff --git a/build-scripts/survey-jquery-ui/README.md b/build-scripts/survey-jquery-ui/README.md deleted file mode 100644 index 1a2d38d875..0000000000 --- a/build-scripts/survey-jquery-ui/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# SurveyJS jQuery Form Library - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your jQuery-powered applications. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with React, Angular, Vue, jQuery, and Knockout -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS jQuery Form Library, refer to the following tutorial: [Add a Survey to a jQuery Application](https://surveyjs.io/Documentation/Library?id=get-started-jquery). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/jquery) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS jQuery Form Library from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-jquery-ui/package.json b/build-scripts/survey-jquery-ui/package.json deleted file mode 100644 index 44dba4665b..0000000000 --- a/build-scripts/survey-jquery-ui/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "survey-jquery-ui", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "jquery", - "jquery-plugin" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-jquery-ui.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey-jquery-ui.d.ts", - "dependencies": { - "jquery": ">=1.12.4" - }, - "peerDependencies": { - "survey-core": "*" - } -} \ No newline at end of file diff --git a/build-scripts/survey-jquery-ui/tsconfig.json b/build-scripts/survey-jquery-ui/tsconfig.json deleted file mode 100644 index aabf0e3a5f..0000000000 --- a/build-scripts/survey-jquery-ui/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tsconfig.json", -} \ No newline at end of file diff --git a/build-scripts/survey-jquery-ui/tsconfig.typing.jquery-ui.json b/build-scripts/survey-jquery-ui/tsconfig.typing.jquery-ui.json deleted file mode 100644 index 0cec6c2970..0000000000 --- a/build-scripts/survey-jquery-ui/tsconfig.typing.jquery-ui.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ], - "@coreIconsV1": [ - "../../build/survey-core/icons/iconsV1" - ], - "@coreIconsV2": [ - "../../build/survey-core/icons/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "strictNullChecks": true, - "jsx": "react", - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/jquery-ui.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-jquery-ui/webpack.config.js b/build-scripts/survey-jquery-ui/webpack.config.js deleted file mode 100644 index c8643d6e3f..0000000000 --- a/build-scripts/survey-jquery-ui/webpack.config.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - resolve: { - alias: { - "react": "preact/compat", - "react-dom/test-utils": "preact/test-utils", - "react-dom": "preact/compat", // Must be below test-utils - "react/jsx-runtime": "preact/jsx-runtime" - }, - extensions: ['.ts', '.tsx'] - }, - externals: { - jquery: { - root: "jQuery", - commonjs2: "jquery", - commonjs: "jquery", - amd: "jquery" - }, - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-jquery-ui/tsconfig.typing.jquery-ui.json", - filePath: "build/survey-jquery-ui/survey-jquery-ui.d.ts", - moduleName: "survey-jquery-ui", - importName: "src/entries/jquery-ui" - }), - ], -}; - -module.exports = function (options) { - options.platform = "jquery-ui"; - options.libraryName = "SurveyJquery"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey-jquery-ui"), config); -} diff --git a/build-scripts/survey-jquery/README.md b/build-scripts/survey-jquery/README.md deleted file mode 100644 index 1a2d38d875..0000000000 --- a/build-scripts/survey-jquery/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# SurveyJS jQuery Form Library - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your jQuery-powered applications. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with React, Angular, Vue, jQuery, and Knockout -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS jQuery Form Library, refer to the following tutorial: [Add a Survey to a jQuery Application](https://surveyjs.io/Documentation/Library?id=get-started-jquery). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/jquery) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS jQuery Form Library from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-jquery/package.json b/build-scripts/survey-jquery/package.json deleted file mode 100644 index 6150075e98..0000000000 --- a/build-scripts/survey-jquery/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "survey-jquery", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "jquery", - "jquery-plugin" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey.jquery.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey.jquery.d.ts", - "dependencies": { - "jquery": ">=1.12.4" - } -} \ No newline at end of file diff --git a/build-scripts/survey-jquery/tsconfig.json b/build-scripts/survey-jquery/tsconfig.json deleted file mode 100644 index 02fa849770..0000000000 --- a/build-scripts/survey-jquery/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions:": { - "baseUrl": ".", - "paths": { - "survey-core": ["../../src/entries/core.ts"], - } - } -} diff --git a/build-scripts/survey-jquery/tsconfig.plugins.themes.typing.json b/build-scripts/survey-jquery/tsconfig.plugins.themes.typing.json deleted file mode 100644 index 4167a94781..0000000000 --- a/build-scripts/survey-jquery/tsconfig.plugins.themes.typing.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "../../build/survey-jquery/themes/typings/" - }, - "include": [ - "../../packages/survey-core/src/themes/index.ts" - ] -} \ No newline at end of file diff --git a/build-scripts/survey-jquery/tsconfig.typing.jquery.json b/build-scripts/survey-jquery/tsconfig.typing.jquery.json deleted file mode 100644 index e0a2ddfb32..0000000000 --- a/build-scripts/survey-jquery/tsconfig.typing.jquery.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../../packages/survey-core/src/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/jquery.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-jquery/webpack.config.js b/build-scripts/survey-jquery/webpack.config.js deleted file mode 100644 index ce5223e87f..0000000000 --- a/build-scripts/survey-jquery/webpack.config.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss") - }, - externals: { - jquery: { - root: "jQuery", - commonjs2: "jquery", - commonjs: "jquery", - amd: "jquery" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-jquery/tsconfig.typing.jquery.json", - filePath: "build/survey-jquery/survey.jquery.d.ts", - moduleName: "survey-jquery", - importName: "src/entries/jquery" - }), - ], -}; - -module.exports = function (options) { - options.platform = "jquery"; - options.libraryName = "Survey"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey.jquery"), config); -} diff --git a/build-scripts/survey-jquery/webpack.themes.config.js b/build-scripts/survey-jquery/webpack.themes.config.js deleted file mode 100644 index f1627b06f6..0000000000 --- a/build-scripts/survey-jquery/webpack.themes.config.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -var path = require("path"); - -const config = { - entry: { - "default-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light.ts"), - "default-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark.ts"), - "default-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light-panelless.ts"), - "default-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark-panelless.ts"), - "sharp-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light.ts"), - "sharp-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark.ts"), - "sharp-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light-panelless.ts"), - "sharp-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark-panelless.ts"), - "borderless-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light.ts"), - "borderless-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark.ts"), - "borderless-light-panelless.": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light-panelless.ts"), - "borderless-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark-panelless.ts"), - "flat-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light.ts"), - "flat-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark.ts"), - "flat-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light-panelless.ts"), - "flat-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark-panelless.ts"), - "plain-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light.ts"), - "plain-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark.ts"), - "plain-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light-panelless.ts"), - "plain-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark-panelless.ts"), - "doubleborder-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light.ts"), - "doubleborder-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark.ts"), - "doubleborder-light-panelles": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light-panelless.ts"), - "doubleborder-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark-panelless.ts"), - "layered-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light.ts"), - "layered-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark.ts"), - "layered-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light-panelless.ts"), - "layered-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark-panelless.ts"), - "solid-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light.ts"), - "solid-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark.ts"), - "solid-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light-panelless.ts"), - "solid-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark-panelless.ts"), - "three-dimensional-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light.ts"), - "three-dimensional-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark.ts"), - "three-dimensional-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light-panelless.ts"), - "three-dimensional-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark-panelless.ts"), - "contrast-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light.ts"), - "contrast-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark.ts"), - "contrast-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light-panelless.ts"), - "contrast-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark-panelless.ts"), - "index": path.resolve(__dirname, "../../packages/survey-core/src/themes/index.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyTheme"; - if (options.buildType !== "prod") { - config.plugins.push(new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-jquery/tsconfig.plugins.themes.typing.json", - filePath: "build/survey-jquery/themes/index.d.ts", - moduleName: "survey-jquery/themes", - importName: "index" - })); - } - - return merge(webpackCommonConfigCreator(options, { "name": "survey-themes" }, "survey.themes", "survey-jquery/themes"), config); -}; diff --git a/build-scripts/survey-js-ui/package.json b/build-scripts/survey-js-ui/package.json deleted file mode 100644 index 4f80d81e57..0000000000 --- a/build-scripts/survey-js-ui/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "survey-js-ui", - "version": "1.11.7", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "jquery", - "jquery-plugin" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-js-ui.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "./typings/src/entries/js-ui.d.ts", - "dependencies": {}, - "peerDependencies": { - "survey-core": "*", - "@types/react-dom": "*", - "@types/react": "*" - } -} \ No newline at end of file diff --git a/build-scripts/survey-js-ui/tsconfig.json b/build-scripts/survey-js-ui/tsconfig.json deleted file mode 100644 index 11c6d6809a..0000000000 --- a/build-scripts/survey-js-ui/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ], - "@coreIconsV1": [ - "../../build/survey-core/icons/iconsV1" - ], - "@coreIconsV2": [ - "../../build/survey-core/icons/iconsV2" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-js-ui/typings", - "skipLibCheck": true, - }, - "include": [ - "../../src/entries/js-ui.ts", - ], - "exclude": [], -} \ No newline at end of file diff --git a/build-scripts/survey-js-ui/webpack.config.js b/build-scripts/survey-js-ui/webpack.config.js deleted file mode 100644 index 0328289aab..0000000000 --- a/build-scripts/survey-js-ui/webpack.config.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - resolve: { - alias: { - "react": "preact/compat", - "react-dom/test-utils": "preact/test-utils", - "react-dom": "preact/compat", - "react/jsx-runtime": "preact/jsx-runtime" - }, - extensions: ['.ts', '.tsx'] - }, - externals: { - jquery: { - root: "jQuery", - commonjs2: "jquery", - commonjs: "jquery", - amd: "jquery" - }, - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - }, -}; - -module.exports = function (options) { - options.platform = "js-ui"; - options.libraryName = "SurveyUI"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.json") - return merge(webpackCommonConfigCreator(options, packageJson, "survey-js-ui"), config); -} diff --git a/build-scripts/survey-knockout-ui/README.md b/build-scripts/survey-knockout-ui/README.md deleted file mode 100644 index baae5028f6..0000000000 --- a/build-scripts/survey-knockout-ui/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# SurveyJS Knockout Form Library - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your Knockout applications. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with React, Angular, Vue, jQuery, and Knockout -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS Knockout Form Library, refer to the following tutorial: [Add a Survey to a Knockout Application](https://surveyjs.io/Documentation/Library?id=get-started-knockout). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/knockoutjs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Knockout Form Library from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-knockout-ui/package.json b/build-scripts/survey-knockout-ui/package.json deleted file mode 100644 index 4ec6958eb6..0000000000 --- a/build-scripts/survey-knockout-ui/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "survey-knockout-ui", - "version": "2.0.0", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "knockout" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-knockout-ui.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey-knockout-ui.d.ts", - "typesVersions": { - "<4.2": { - "*": [ - "ts3.4/*" - ] - } - }, - "peerDependencies": { - "survey-core": "*" - }, - "dependencies": { - "knockout": "^3.5.0" - } -} \ No newline at end of file diff --git a/build-scripts/survey-knockout-ui/tsconfig.json b/build-scripts/survey-knockout-ui/tsconfig.json deleted file mode 100644 index 91335461c6..0000000000 --- a/build-scripts/survey-knockout-ui/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tsconfig.json", -} diff --git a/build-scripts/survey-knockout-ui/tsconfig.typing.ko-ui.json b/build-scripts/survey-knockout-ui/tsconfig.typing.ko-ui.json deleted file mode 100644 index 11da4a8903..0000000000 --- a/build-scripts/survey-knockout-ui/tsconfig.typing.ko-ui.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ], - "@coreIconsV1": [ - "../../build/survey-core/icons/iconsV1" - ], - "@coreIconsV2": [ - "../../build/survey-core/icons/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/knockout-ui-model.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-knockout-ui/webpack.config.js b/build-scripts/survey-knockout-ui/webpack.config.js deleted file mode 100644 index 566166cacd..0000000000 --- a/build-scripts/survey-knockout-ui/webpack.config.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); - -const config = { - externals: { - knockout: { - root: "ko", - commonjs2: "knockout", - commonjs: "knockout", - amd: "knockout" - }, - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-knockout-ui/tsconfig.typing.ko-ui.json", - filePath: "build/survey-knockout-ui/survey-knockout-ui.d.ts", - moduleName: "survey-knockout-ui", - importName: "entries/knockout-ui-model" - }), - ], -}; - -module.exports = function (options) { - options.platform = "knockout-ui"; - options.libraryName = "SurveyKnockout"; - return merge(webpackCommonConfigCreator(options, packageJson), config); -} diff --git a/build-scripts/survey-knockout/README.md b/build-scripts/survey-knockout/README.md deleted file mode 100644 index e3e032c808..0000000000 --- a/build-scripts/survey-knockout/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# SurveyJS Form Library for Knockout - - - - - -SurveyJS Form Library is a free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your web applications. - -> **NOTE**: This package contains a legacy version of SurveyJS Form Library for Knockout. We recommend using a [new implementation](https://www.npmjs.com/package/survey-react-ui) that separates the data model from the UI rendering. For information on how to integrate it into your application, refer to the following tutorial: [Add a Survey to a Knockout Application](https://surveyjs.io/form-library/documentation/get-started-knockout). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/knockoutjs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Form Library for Knockout from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-knockout/karma.conf.knockout.js b/build-scripts/survey-knockout/karma.conf.knockout.js deleted file mode 100644 index f8de30a26d..0000000000 --- a/build-scripts/survey-knockout/karma.conf.knockout.js +++ /dev/null @@ -1,9 +0,0 @@ -var karmaKonf = require("../karma.conf"); - -module.exports = function(config) { - karmaKonf(config); - config.set({ - basePath: "../../", - files: ["tests/markup/question_knockout_tests.ts"], - }); -}; diff --git a/build-scripts/survey-knockout/package.json b/build-scripts/survey-knockout/package.json deleted file mode 100644 index f51ac014c6..0000000000 --- a/build-scripts/survey-knockout/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "survey-knockout", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "knockout" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey.ko.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey.ko.d.ts", - "typesVersions": { - "<4.2": { - "*": [ - "ts3.4/*" - ] - } - }, - "dependencies": { - "knockout": "^3.5.1" - } -} \ No newline at end of file diff --git a/build-scripts/survey-knockout/tsconfig.json b/build-scripts/survey-knockout/tsconfig.json deleted file mode 100644 index 02fa849770..0000000000 --- a/build-scripts/survey-knockout/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions:": { - "baseUrl": ".", - "paths": { - "survey-core": ["../../src/entries/core.ts"], - } - } -} diff --git a/build-scripts/survey-knockout/tsconfig.typing.ko.json b/build-scripts/survey-knockout/tsconfig.typing.ko.json deleted file mode 100644 index b912ced94b..0000000000 --- a/build-scripts/survey-knockout/tsconfig.typing.ko.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../../packages/survey-core/src/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/knockout.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-knockout/webpack.config.js b/build-scripts/survey-knockout/webpack.config.js deleted file mode 100644 index 6509e9c7b0..0000000000 --- a/build-scripts/survey-knockout/webpack.config.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss") - }, - externals: { - knockout: { - root: "ko", - commonjs2: "knockout", - commonjs: "knockout", - amd: "knockout" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-knockout/tsconfig.typing.ko.json", - filePath: "build/survey-knockout/survey.ko.d.ts", - moduleName: "survey-knockout", - importName: "src/entries/knockout" - }), - ], -}; - -module.exports = function (options) { - options.platform = "knockout"; - options.libraryName = "Survey"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey.ko"), config); -} diff --git a/build-scripts/survey-react-ui/README.md b/build-scripts/survey-react-ui/README.md deleted file mode 100644 index 9a9e4f2be2..0000000000 --- a/build-scripts/survey-react-ui/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# SurveyJS React Form Library - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your React applications. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with React, Angular, Vue, jQuery, and Knockout -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS React Form Library, refer to the following tutorial: [Add a Survey to a React Application](https://surveyjs.io/Documentation/Library?id=get-started-react). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/reactjs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS React Form Library from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-react-ui/package.json b/build-scripts/survey-react-ui/package.json deleted file mode 100644 index 9eee0f2db8..0000000000 --- a/build-scripts/survey-react-ui/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "survey-react-ui", - "version": "2.0.0", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "knockout" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-react-ui.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "./typings/src/entries/react-ui.d.ts", - "peerDependencies": { - "survey-core": "*", - "react": "^16.5.0 || ^17.0.1 || ^18.2.0 || ^19.0.0", - "react-dom": "^16.5.0 || ^17.0.1 || ^18.2.0 || ^19.0.0" - } -} \ No newline at end of file diff --git a/build-scripts/survey-react-ui/tsconfig.json b/build-scripts/survey-react-ui/tsconfig.json deleted file mode 100644 index daaf7ceaff..0000000000 --- a/build-scripts/survey-react-ui/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "jsx": "react", - "paths": { - "survey-core": [ - "../../build/survey-core" - ], - "@coreIconsV1": [ - "../../build/survey-core/icons/iconsV1" - ], - "@coreIconsV2": [ - "../../build/survey-core/icons/iconsV2" - ] - }, - "declaration": true, - "declarationDir": "../../build/survey-react-ui/typings" - }, - "include": [ - "../../src/entries/react-ui.ts" - ], - "exclude": [] -} \ No newline at end of file diff --git a/build-scripts/survey-react-ui/webpack.config.js b/build-scripts/survey-react-ui/webpack.config.js deleted file mode 100644 index 2c1a3d1dd1..0000000000 --- a/build-scripts/survey-react-ui/webpack.config.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -const packageJson = require("./package.json"); -const path = require("path"); - -const config = { - externals: { - react: { - root: "React", - commonjs2: "react", - commonjs: "react", - amd: "react" - }, - "react-dom": { - root: "ReactDOM", - commonjs2: "react-dom", - commonjs: "react-dom", - amd: "react-dom" - }, - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - }, -}; - -module.exports = function (options) { - options.platform = "react-ui"; - options.libraryName = "SurveyReact"; - options.tsConfigFile = path.resolve(__dirname, "./tsconfig.json") - return merge(webpackCommonConfigCreator(options, packageJson), config); -} diff --git a/build-scripts/survey-react/README.md b/build-scripts/survey-react/README.md deleted file mode 100644 index 109fb5d8c6..0000000000 --- a/build-scripts/survey-react/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# SurveyJS Form Library for React - - - - - -SurveyJS Form Library is a free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your web applications. - -> **NOTE**: This package contains a legacy Knockout-dependent version of SurveyJS Form Library for React. We recommend using a new [native implementation of SurveyJS React Form Library](https://www.npmjs.com/package/survey-react-ui). For information on how to integrate it into your application, refer to the following tutorial: [Add a Survey to a React Application](https://surveyjs.io/form-library/documentation/get-started-react). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/reactjs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Form Library for React from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-react/karma.conf.react.js b/build-scripts/survey-react/karma.conf.react.js deleted file mode 100644 index f3100790fc..0000000000 --- a/build-scripts/survey-react/karma.conf.react.js +++ /dev/null @@ -1,9 +0,0 @@ -var karmaKonf = require("../karma.conf"); - -module.exports = function(config) { - karmaKonf(config); - config.set({ - basePath: "../../", - files: ["tests/markup/question_react_tests.ts"], - }); -}; \ No newline at end of file diff --git a/build-scripts/survey-react/package.json b/build-scripts/survey-react/package.json deleted file mode 100644 index e5fba3e5fb..0000000000 --- a/build-scripts/survey-react/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "survey-react", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "react", - "react-component" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey.react.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey.react.d.ts", - "peerDependencies": { - "react": "^16.5.0 || ^17.0.1 || ^18.1.0", - "react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0" - } -} \ No newline at end of file diff --git a/build-scripts/survey-react/tsconfig.json b/build-scripts/survey-react/tsconfig.json deleted file mode 100644 index 02fa849770..0000000000 --- a/build-scripts/survey-react/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions:": { - "baseUrl": ".", - "paths": { - "survey-core": ["../../src/entries/core.ts"], - } - } -} diff --git a/build-scripts/survey-react/tsconfig.typing.react.json b/build-scripts/survey-react/tsconfig.typing.react.json deleted file mode 100644 index d65c69877e..0000000000 --- a/build-scripts/survey-react/tsconfig.typing.react.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../../packages/survey-core/src/iconsV2" - ] - }, - "sourceMap": false, - "noImplicitAny": false, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "jsx": "react", - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true - }, - "include": [ - "../../src/entries/react.ts" - ], -} \ No newline at end of file diff --git a/build-scripts/survey-react/webpack.config.js b/build-scripts/survey-react/webpack.config.js deleted file mode 100644 index 1c15b892be..0000000000 --- a/build-scripts/survey-react/webpack.config.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss") - }, - externals: { - react: { - root: "React", - commonjs2: "react", - commonjs: "react", - amd: "react" - }, - "react-dom": { - root: "ReactDOM", - commonjs2: "react-dom", - commonjs: "react-dom", - amd: "react-dom" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-react/tsconfig.typing.react.json", - filePath: "build/survey-react/survey.react.d.ts", - moduleName: "survey-react", - importName: "src/entries/react" - }), - ], -}; - -module.exports = function (options) { - options.platform = "react"; - options.libraryName = "Survey"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey.react"), config); -} diff --git a/build-scripts/survey-vue-ui/README.md b/build-scripts/survey-vue-ui/README.md deleted file mode 100644 index 6df3a934f4..0000000000 --- a/build-scripts/survey-vue-ui/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# SurveyJS Vue Form Library (Vue 2) - - - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your Vue applications. - -> **NOTE**: This package contains a version of SurveyJS Form Library for Vue 2. If you are looking for a Vue 3 version, refer to the [survey-vue3-ui](https://www.npmjs.com/package/survey-vue3-ui) npm package. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with React, Angular, Vue, jQuery, and Knockout -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS Vue Form Library, refer to the following tutorial: [Add a Survey to a Vue 2 Application](https://surveyjs.io/form-library/documentation/get-started-vue#add-a-survey-to-a-vue-2-application). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/vuejs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Vue Form Library from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-vue-ui/package.json b/build-scripts/survey-vue-ui/package.json deleted file mode 100644 index 7385e7505b..0000000000 --- a/build-scripts/survey-vue-ui/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "survey-vue-ui", - "version": "2.0.0", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "knockout" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-vue-ui.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey-vue-ui.d.ts", - "peerDependencies": { - "survey-core": "*" - }, - "dependencies": { - "vue": "^2.6.12" - } -} \ No newline at end of file diff --git a/build-scripts/survey-vue-ui/tsconfig.json b/build-scripts/survey-vue-ui/tsconfig.json deleted file mode 100644 index 91335461c6..0000000000 --- a/build-scripts/survey-vue-ui/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tsconfig.json", -} diff --git a/build-scripts/survey-vue-ui/tsconfig.typing.vue-ui.json b/build-scripts/survey-vue-ui/tsconfig.typing.vue-ui.json deleted file mode 100644 index e328fa6a55..0000000000 --- a/build-scripts/survey-vue-ui/tsconfig.typing.vue-ui.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ], - "@coreIconsV1": [ - "../../build/survey-core/icons/iconsV1" - ], - "@coreIconsV2": [ - "../../build/survey-core/icons/iconsV2" - ] - }, - "types": [ - "vite/client", - ], - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true, - "experimentalDecorators": true, - "moduleResolution": "Node" - }, - "include": [ - "../../src/entries/vue-ui-model.ts" - ] -} \ No newline at end of file diff --git a/build-scripts/survey-vue-ui/webpack.config.js b/build-scripts/survey-vue-ui/webpack.config.js deleted file mode 100644 index f5b5b0104b..0000000000 --- a/build-scripts/survey-vue-ui/webpack.config.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); - -const config = { - externals: { - vue: { - root: "Vue", - commonjs2: "vue", - commonjs: "vue", - amd: "vue" - }, - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsCommand: "vue-tsc --project", - tsConfigPath: "./build-scripts/survey-vue-ui/tsconfig.typing.vue-ui.json", - filePath: "build/survey-vue-ui/survey-vue-ui.d.ts", - moduleName: "survey-vue-ui", - importName: "entries/vue-ui-model" - }), - ], -}; - -module.exports = function (options) { - options.platform = "vue-ui"; - options.libraryName = "SurveyVue"; - return merge(webpackCommonConfigCreator(options, packageJson), config); -} diff --git a/build-scripts/survey-vue/README.md b/build-scripts/survey-vue/README.md deleted file mode 100644 index 0c3d49fb82..0000000000 --- a/build-scripts/survey-vue/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# SurveyJS Form Library for Vue - - - - - -SurveyJS Form Library is a free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your web applications. - -> **NOTE**: This package contains a legacy Knockout-dependent version of SurveyJS Form Library for Vue. We recommend using a new [native implementation of SurveyJS Vue Form Library](https://www.npmjs.com/package/survey-vue-ui). For information on how to integrate it into your application, refer to the following tutorial: [Add a Survey to a Vue Application](https://surveyjs.io/form-library/documentation/get-started-vue). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/Documentation/Library) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/vuejs) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Form Library for Vue from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). diff --git a/build-scripts/survey-vue/karma.conf.vue.js b/build-scripts/survey-vue/karma.conf.vue.js deleted file mode 100644 index 39e67f2250..0000000000 --- a/build-scripts/survey-vue/karma.conf.vue.js +++ /dev/null @@ -1,10 +0,0 @@ -var karmaKonf = require("../karma.conf"); - -module.exports = function(config) { - karmaKonf(config); - config.set({ - basePath: "../../", - files: ["tests/markup/question_vue_tests.ts"], - browserConsoleLogOptions: {level: "warn"} - }); -}; \ No newline at end of file diff --git a/build-scripts/survey-vue/package.json b/build-scripts/survey-vue/package.json deleted file mode 100644 index 74931d2338..0000000000 --- a/build-scripts/survey-vue/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "survey-vue", - "version": "1.8.33", - "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", - "keywords": [ - "Survey", - "JavaScript", - "Bootstrap", - "Library", - "vue" - ], - "homepage": "https://surveyjs.io/", - "license": "MIT", - "files": [ - "**/*" - ], - "main": "survey-vue.js", - "repository": { - "type": "git", - "url": "https://github.com/surveyjs/surveyjs.git" - }, - "typings": "survey.vue.d.ts", - "dependencies": { - "vue": "^2.1.10" - } -} \ No newline at end of file diff --git a/build-scripts/survey-vue/tsconfig.json b/build-scripts/survey-vue/tsconfig.json deleted file mode 100644 index 02fa849770..0000000000 --- a/build-scripts/survey-vue/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions:": { - "baseUrl": ".", - "paths": { - "survey-core": ["../../src/entries/core.ts"], - } - } -} diff --git a/build-scripts/survey-vue/tsconfig.plugins.themes.typing.json b/build-scripts/survey-vue/tsconfig.plugins.themes.typing.json deleted file mode 100644 index 372361210c..0000000000 --- a/build-scripts/survey-vue/tsconfig.plugins.themes.typing.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../build/survey-core" - ] - }, - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "../../build/survey-vue/themes/typings/" - }, - "include": [ - "../../packages/survey-core/src/themes/index.ts" - ] -} \ No newline at end of file diff --git a/build-scripts/survey-vue/tsconfig.typing.vue.json b/build-scripts/survey-vue/tsconfig.typing.vue.json deleted file mode 100644 index 67ba456416..0000000000 --- a/build-scripts/survey-vue/tsconfig.typing.vue.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES2015.Promise", - "es6" - ], - "baseUrl": ".", - "paths": { - "survey-core": [ - "../../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../../packages/survey-core/src/iconsV2" - ] - }, - "types": [ - "vite/client", - "node", - ], - "declaration": true, - "emitDeclarationOnly": true, - "skipLibCheck": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "moduleResolution": "Node" - }, - "include": [ - "../../src/entries/vue.ts" - ] -} \ No newline at end of file diff --git a/build-scripts/survey-vue/webpack.config.js b/build-scripts/survey-vue/webpack.config.js deleted file mode 100644 index 562822603f..0000000000 --- a/build-scripts/survey-vue/webpack.config.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -const { merge } = require("webpack-merge"); -var packageJson = require("./package.json"); -var path = require("path"); - -const config = { - entry: { - survey: path.resolve(__dirname, "../../src/main.scss"), - modern: path.resolve(__dirname, "../../src/modern.scss"), - defaultV2: path.resolve(__dirname, "../../packages/survey-core/src/defaultV2-theme/defaultV2.scss") - }, - externals: { - vue: { - root: "Vue", - commonjs2: "vue", - commonjs: "vue", - amd: "vue" - } - }, - plugins: [ - new DtsGeneratorPlugin({ - tsCommand: "vue-tsc --project", - tsConfigPath: "./build-scripts/survey-vue/tsconfig.typing.vue.json", - filePath: "build/survey-vue/survey.vue.d.ts", - moduleName: "survey-vue", - importName: "src/entries/vue" - }), - ], -}; - -module.exports = function (options) { - options.platform = "vue"; - options.libraryName = "Survey"; - return merge(webpackCommonConfigCreator(options, packageJson, "survey.vue"), config); -} diff --git a/build-scripts/survey-vue/webpack.themes.config.js b/build-scripts/survey-vue/webpack.themes.config.js deleted file mode 100644 index 0ff6a7a198..0000000000 --- a/build-scripts/survey-vue/webpack.themes.config.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -const webpackCommonConfigCreator = require("../webpack.common"); -const { merge } = require("webpack-merge"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -const DtsGeneratorPlugin = require("../webpack-dts-generator"); -var path = require("path"); - -const config = { - entry: { - "default-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light.ts"), - "default-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark.ts"), - "default-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-light-panelless.ts"), - "default-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/default-dark-panelless.ts"), - "sharp-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light.ts"), - "sharp-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark.ts"), - "sharp-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-light-panelless.ts"), - "sharp-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/sharp-dark-panelless.ts"), - "borderless-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light.ts"), - "borderless-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark.ts"), - "borderless-light-panelless.": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-light-panelless.ts"), - "borderless-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/borderless-dark-panelless.ts"), - "flat-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light.ts"), - "flat-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark.ts"), - "flat-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-light-panelless.ts"), - "flat-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/flat-dark-panelless.ts"), - "plain-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light.ts"), - "plain-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark.ts"), - "plain-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-light-panelless.ts"), - "plain-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/plain-dark-panelless.ts"), - "doubleborder-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light.ts"), - "doubleborder-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark.ts"), - "doubleborder-light-panelles": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-light-panelless.ts"), - "doubleborder-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/doubleborder-dark-panelless.ts"), - "layered-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light.ts"), - "layered-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark.ts"), - "layered-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-light-panelless.ts"), - "layered-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/layered-dark-panelless.ts"), - "solid-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light.ts"), - "solid-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark.ts"), - "solid-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-light-panelless.ts"), - "solid-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/solid-dark-panelless.ts"), - "three-dimensional-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light.ts"), - "three-dimensional-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark.ts"), - "three-dimensional-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-light-panelless.ts"), - "three-dimensional-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/threedimensional-dark-panelless.ts"), - "contrast-light": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light.ts"), - "contrast-dark": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark.ts"), - "contrast-light-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-light-panelless.ts"), - "contrast-dark-panelless": path.resolve(__dirname, "../../packages/survey-core/src/themes/contrast-dark-panelless.ts"), - "index": path.resolve(__dirname, "../../packages/survey-core/src/themes/index.ts"), - }, - plugins: [new FixStyleOnlyEntriesPlugin()], - externals: { - "survey-core": { - root: "Survey", - commonjs2: "survey-core", - commonjs: "survey-core", - amd: "survey-core" - } - } -}; - -module.exports = function (options) { - options.platform = ""; - options.libraryName = "SurveyTheme"; - if (options.buildType !== "prod") { - config.plugins.push(new DtsGeneratorPlugin({ - tsConfigPath: "./build-scripts/survey-vue/tsconfig.plugins.themes.typing.json", - filePath: "build/survey-vue/themes/index.d.ts", - moduleName: "survey-vue/themes", - importName: "index" - })); - } - - return merge(webpackCommonConfigCreator(options, { "name": "survey-themes" }, "survey.themes", "survey-vue/themes"), config); -}; diff --git a/build-scripts/svgbundle.pug b/build-scripts/svgbundle.pug deleted file mode 100644 index 2ffadcd398..0000000000 --- a/build-scripts/svgbundle.pug +++ /dev/null @@ -1,16 +0,0 @@ -svg(style={display: 'none'})&attributes(svg) - - mixin parseObject(obj) - each child in obj - if child !== null && child.type === 'text' - | - else if child !== null && typeof child.children === 'object' - | #[#{child.name}&attributes(child.attribs) #[+parseObject(child.children)]] - - if defs.length - defs - each def in defs - | #[#{def.name}&attributes(def.attribs) #[+parseObject(def.children)]] - - each symbol in symbols - | #[#{symbol.name}&attributes(symbol.attribs) #[+parseObject(symbol.children)]] diff --git a/build-scripts/tsconfig.json b/build-scripts/tsconfig.json deleted file mode 100644 index 7f57f41527..0000000000 --- a/build-scripts/tsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "lib": [ - "DOM", - "ES5", - "ES6", - "ES2015.Promise" - ], - "sourceMap": true, - "noImplicitAny": true, - "importHelpers": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "jsx": "react", - "baseUrl": ".", - "paths": { - "@coreIconsV1": [ - "../build/survey-core/icons/iconsV1.d.ts" - ], - "@coreIconsV2": [ - "../build/survey-core/icons/iconsV2.d.ts" - ] - } - }, - "exclude": [ - "../src/entries/**/*.ts" - ], - "include": [ - "../src/**/*.ts" - ] -} \ No newline at end of file diff --git a/build-scripts/tsconfig.tests.json b/build-scripts/tsconfig.tests.json deleted file mode 100644 index cd2a3c2866..0000000000 --- a/build-scripts/tsconfig.tests.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "noImplicitAny": false, - "paths": { - "survey-core": [ - "../src/entries/core.ts" - ], - "@coreIconsV1": [ - "../packages/survey-core/src/iconsV1" - ], - "@coreIconsV2": [ - "../packages/survey-core/src/iconsV2" - ], - "@legacy/*": [ - "../src/*" - ] - } - } -} \ No newline at end of file diff --git a/build-scripts/tslint.json b/build-scripts/tslint.json deleted file mode 100644 index 4b93c3f11e..0000000000 --- a/build-scripts/tslint.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "rules": { - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": true, - "indent": [true, "spaces"], - "label-position": true, - "label-undefined": true, - "max-line-length": [true, 140], - "member-access": false, - "member-ordering": [ - true, - "static-before-instance", - "variables-before-functions" - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": false, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "quotemark": [true, "double"], - "radix": true, - "semicolon": ["always"], - "triple-equals": [true, "allow-null-check"], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/build-scripts/webpack-bundle-svg.js b/build-scripts/webpack-bundle-svg.js deleted file mode 100644 index 4af4428e00..0000000000 --- a/build-scripts/webpack-bundle-svg.js +++ /dev/null @@ -1,9 +0,0 @@ -class BundleSvgPlugin { - apply(compiler) { - compiler.hooks.afterEnvironment.tap('BundleSvgPlugin', (params) => { - // params['MyPlugin - data'] = 'important stuff my plugin will use later'; - }); - } -} - -module.exports = BundleSvgPlugin; diff --git a/build-scripts/webpack-dts-generator.js b/build-scripts/webpack-dts-generator.js deleted file mode 100644 index 51470c7b64..0000000000 --- a/build-scripts/webpack-dts-generator.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; -const webpack = require("webpack"); -const fs = require('fs'); -const path = require('path'); -const child_process = require('child_process'); - -const legacyModules = ["survey-angular", "survey-jquery", "survey-knockout", "survey-react", "survey-vue"]; - -module.exports = function DtsGeneratorProgressPlugin(options) { - return new webpack.ProgressPlugin(function (progress) { - if (progress === 1) { - console.log("typings start"); - console.log("typescript start"); - const tsConfigPath = options.tsConfigPath || "tsconfig.typing.json"; - const tsCommand = options.tsCommand || "tsc --p"; - let command = tsCommand + " " + tsConfigPath + " --outDir " + path.dirname(options.filePath) + "/typings/"; - if (legacyModules.indexOf(options.moduleName) !== -1) { - command = tsCommand + " " + tsConfigPath + " --outFile " + options.filePath; - } - console.log("tsc command is \"" + command + "\""); - child_process.execSync(command, { stdio: "inherit" }); - console.log("typescript end"); - - let content = "\nexport * from \"./typings/" + options.importName + "\";"; - if (legacyModules.indexOf(options.moduleName) !== -1) { - content = "\ndeclare module \"" + options.moduleName + "\" { import main = require(\"" + options.importName + "\"); export = main; }"; - } - console.log("\"" + content + "\""); - console.log(options.filePath); - if (legacyModules.indexOf(options.moduleName) !== -1) { - fs.writeFile(options.filePath, content, { flag: 'a' }, err => { if (err) { console.error(err); } }); - } else { - fs.writeFile(options.filePath, content, { flag: 'w' }, err => { if (err) { console.error(err); } }); - } - console.log("typings end"); - } - }); -}; diff --git a/build-scripts/webpack.common.js b/build-scripts/webpack.common.js deleted file mode 100644 index a77fae93d1..0000000000 --- a/build-scripts/webpack.common.js +++ /dev/null @@ -1,260 +0,0 @@ -"use strict"; - -var webpack = require("webpack"); -var path = require("path"); -var MiniCssExtractPlugin = require("mini-css-extract-plugin"); -var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); -var RemoveCoreFromName = require("./webpack-remove-core-from-name"); -var TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); -const VueLoaderPlugin = require("vue-loader/lib/plugin"); -var GenerateJsonPlugin = require("generate-json-webpack-plugin"); -var DashedNamePlugin = require("./webpack-dashed-name"); -var CamelCaseNamePlugin = require("./webpack-camel-name"); - -var packageJsonWithVersion = require("../package.json"); -var fs = require("fs"); -var replace = require("replace-in-file"); -var svgStoreUtils = require(path.resolve( - __dirname, - "../node_modules/webpack-svgstore-plugin/src/helpers/utils.js" -)); - -module.exports = function (options, packageJson, chunkName, buildFolderName) { - packageJson.version = packageJsonWithVersion.version; - const today = new Date(); - const year = today.getFullYear(); - var banner = [ - "surveyjs - Survey JavaScript library v" + packageJson.version, - "Copyright (c) 2015-" + year + " Devsoft Baltic OÃœ - http://surveyjs.io/", - "License: MIT (http://www.opensource.org/licenses/mit-license.php)", - ].join("\n"); - - var buildPath = __dirname + "/../build/" + (buildFolderName || packageJson.name) + "/"; - var isProductionBuild = options.buildType === "prod"; - - if (!!packageJson.peerDependencies && packageJson.peerDependencies["survey-core"]) { - packageJson.peerDependencies["survey-core"] = packageJson.version; - } - - function createSVGBundle() { - var options = { - fileName: path.resolve( - path.join("./src"), - "./svgbundle.html" - ), - template: path.resolve(__dirname, "./svgbundle.pug"), - svgoOptions: { - plugins: [{ removeTitle: true }], - }, - prefix: "icon-", - }; - - svgStoreUtils.filesMap(path.join("./src/images/**/*.svg"), files => { - const fileContent = svgStoreUtils.createSprite( - svgStoreUtils.parseFiles(files, options), - options.template - ); - fs.writeFileSync(options.fileName, fileContent); - }); - } - - function replaceLines(fileName, regex, to) { - replace.sync( - { - files: fileName, - from: regex, - to: to, - }, - (error, changes) => { - if (error) { - return console.error("Error occurred:", error); - } - console.log("check me : " + fileName); - console.log("Modified files:", changes.join(", ")); - } - ); - } - - function removeLines(fileName, regex) { - replace.sync( - { - files: fileName, - from: regex, - to: "", - }, - (error, changes) => { - if (error) { - return console.error("Error occurred:", error); - } - console.log("check me : " + fileName); - console.log("Modified files:", changes.join(", ")); - } - ); - } - - var packageName = chunkName || packageJson.name; - - var percentage_handler = function handler(percentage, msg) { - if (0 == percentage) { - console.log("Build started... good luck!"); - } else if (1 == percentage) { - if (isProductionBuild) { - if (fs.existsSync(buildPath + "survey.vue.js")) - fs.copyFileSync( - buildPath + "survey.vue.js", - buildPath + "survey-vue.js" - ); - if (fs.existsSync(buildPath + "survey.vue.min.js")) - fs.copyFileSync( - buildPath + "survey.vue.min.js", - buildPath + "survey-vue.min.js" - ); - if (fs.existsSync(__dirname + "/" + packageJson.name + "/README.md")) - fs.copyFileSync( - __dirname + "/" + packageJson.name + "/README.md", - buildPath + "/README.md" - ); - } - } - }; - - var config = { - mode: isProductionBuild ? "production" : "development", - resolve: { - extensions: [".ts", ".js", ".tsx", ".scss"], - plugins: [new TsconfigPathsPlugin({ configFile: options.tsConfigFile || "./tsconfig.json" })], - alias: { - "@coreIconsV1": path.resolve(__dirname, "../build/survey-core/icons/iconsV1.js"), - "@coreIconsV2": path.resolve(__dirname, "../build/survey-core/icons/iconsV2.js"), - }, - }, - optimization: { - minimize: isProductionBuild, - concatenateModules: true - }, - module: { - rules: [ - { - test: /\.(ts|tsx)$/, - loader: "ts-loader", - options: { - transpileOnly: isProductionBuild, - appendTsSuffixTo: [/\.vue$/], - configFile: options.tsConfigFile || 'tsconfig.json' - }, - }, - { - test: /\.vue$/, - use: { - loader: "vue-loader", - options: { - esModule: true, - }, - }, - }, - { - test: /\.css$/, - loader: [ - MiniCssExtractPlugin.loader, - { - loader: "css-loader", - options: { - sourceMap: options.buildType !== "prod", - }, - }, - ], - }, - { - test: /\.s(c|a)ss$/, - loader: [ - MiniCssExtractPlugin.loader, - { - loader: "css-loader", - options: { - sourceMap: options.buildType !== "prod", - }, - }, - { - loader: "sass-loader", - options: { - sourceMap: options.buildType !== "prod", - }, - }, - ], - }, - { - test: /\.html$/, - loader: "html-loader", - }, - { - test: /\.(svg)$/, - use: { - loader: "svg-inline-loader", - options: {}, - }, - }, - ], - }, - output: { - path: buildPath, - filename: "[name]" + (isProductionBuild ? ".min" : "") + ".js", - library: { - root: options.libraryName, - amd: '[dashedname]', - commonjs: '[dashedname]', - }, - libraryTarget: "umd", - globalObject: 'this', - umdNamedDefine: true, - }, - plugins: [ - new webpack.DefinePlugin({ - "process.env.ENVIRONMENT": JSON.stringify(options.buildType), - "process.env.VERSION": JSON.stringify(packageJson.version), - "process.env.RELEASE_DATE": JSON.stringify(new Date().toISOString().slice(0, 10)), - }), - new MiniCssExtractPlugin({ - filename: isProductionBuild ? "[rc-name].min.css" : "[rc-name].css", - }), - new VueLoaderPlugin(), - new webpack.WatchIgnorePlugin([/svgbundle\.html/]), - new webpack.BannerPlugin({ - banner: banner, - }), - new RemoveCoreFromName(), - new FixStyleOnlyEntriesPlugin(), - new DashedNamePlugin(), - new CamelCaseNamePlugin() - ], - }; - - if (!!options.platform) { - config.plugins.unshift(new webpack.ProgressPlugin(percentage_handler)); - config.entry = { - [packageName]: path.resolve( - __dirname, - "../src/entries/" + options.platform + ".ts" - ), - }; - } - - if (isProductionBuild) { - if (!!options.platform) { - config.plugins.push( - new GenerateJsonPlugin( - /*buildPath +*/ "package.json", - packageJson, - undefined, - 2 - ) - ); - } - } else { - config.devtool = "source-map"; - config.plugins = config.plugins.concat([ - new webpack.LoaderOptionsPlugin({ debug: true }), - ]); - } - - return config; -}; \ No newline at end of file diff --git a/devops-accessibility-tests.yml b/devops-accessibility-tests.yml index 3671f9de57..510a963b3b 100644 --- a/devops-accessibility-tests.yml +++ b/devops-accessibility-tests.yml @@ -3,396 +3,343 @@ # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript - trigger: batch: true branches: exclude: - - master + - master tags: exclude: - v*.*.* pool: - vmImage: 'windows-latest' + vmImage: "windows-latest" jobs: -- job: Knockout - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_knockout_prod - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:knockout - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Knockout_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Knockout_AXE/' - ArtifactName: 'Library_Knockout_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: React - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_react_prod - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_react_ui - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:react - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_React_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_React_AXE/' - ArtifactName: 'Library_React_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Vue - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_vue_prod - displayName: 'build prod' - - - script: | - npm run accessibility-tests:ci:vue - displayName: 'Accessibility Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue_AXE/' - ArtifactName: 'Library_Vue_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Angular - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-angular-ui - npm install - displayName: "NPM install packages/survey-angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build - displayName: "Build Angular" - - - script: | - cd packages/survey-angular-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build:example - displayName: "Build Angular Example" - - - script: | - npm run accessibility-tests:ci:angular - displayName: "run accessibility tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Angular_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Angular_AXE/' - ArtifactName: 'Library_Angular_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' - -- job: Vue3 - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-vue3-ui - npm install - displayName: "NPM install packages/survey-vue3-ui" - - - script: | - cd packages/survey-vue3-ui - npm run build - displayName: "Build Vue3" - - - script: | - cd packages/survey-vue3-ui/example - npm install - displayName: "NPM install Vue3 example" - - - script: | - cd packages/survey-vue3-ui/example - npm run build - displayName: "Build Vue3 Example" - - - script: | - npm run accessibility-tests:ci:vue3 - displayName: "run accessibility tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue3_AXE' - OverWrite: true - condition: always() - displayName: 'copy accessibility artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue3_AXE/' - ArtifactName: 'Library_Vue3_AXE' - publishLocation: 'Container' - condition: always() - displayName: 'publish accessibility artifacts' \ No newline at end of file + - job: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npm run lint + displayName: "run lint command" + + - script: | + cd packages/survey-core + npm install + displayName: "NPM install packages/survey-core" + + - script: | + cd packages/survey-core + npm run build:all + displayName: "Build core" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core" + ArtifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + publishLocation: "Container" + + - job: React + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-react-ui + npm install + displayName: "NPM install packages/survey-react-ui" + + - script: | + cd packages/survey-react-ui + npm run build + displayName: "Build React" + + - script: | + cd packages/survey-react-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: Angular + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-angular-ui + npm install + displayName: "NPM install packages/survey-angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build + displayName: "Build Angular" + + - script: | + cd packages/survey-angular-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build:example:prod + displayName: "Build Angular Example" + + - script: | + cd packages/survey-angular-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: Vue3 + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-vue3-ui + npm install + displayName: "NPM install packages/survey-vue3-ui" + + - script: | + cd packages/survey-vue3-ui + npm run build + displayName: "Build Vue3" + + - script: | + cd packages/survey-vue3-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-vue3-ui/example + npm run build + displayName: "Build Vue3 Example" + + - script: | + cd packages/survey-vue3-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" + + - job: SurveyUI_and_CSSFrameworks + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory) + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-AT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-AT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-js-ui + npm install + displayName: "NPM install packages/survey-js-ui" + + - script: | + cd packages/survey-js-ui + npm run build + displayName: "Build UI" + + - script: | + cd packages/survey-js-ui + npm run accessibility-tests:ci + displayName: "run accessibility tests" diff --git a/devops-pull-requests-parallel-jobs.yml b/devops-pull-requests-parallel-jobs.yml index d156e30c6e..78b3d87d88 100644 --- a/devops-pull-requests-parallel-jobs.yml +++ b/devops-pull-requests-parallel-jobs.yml @@ -16,409 +16,374 @@ pool: vmImage: "ubuntu-latest" jobs: - -- job: Knockout - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_core - npm run build_knockout_prod - displayName: "Build Knockout" - - - script: | - npm run test:postcss - displayName: "check postcss compatibility" - - - script: | - npm run testsingle - displayName: "run unit tests" - - - script: | - npm run lint - displayName: "eslint check" - - - script: | - npm run test:knockout:single - displayName: "run markup tests" - - - bash: | - npm run testcafe:ko - displayName: "run functional tests" - -- job: React - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_react_prod - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_react_ui - displayName: "Build React" - - - script: | - npm run test:react:single - displayName: "run markup tests" - - - bash: | - npm run testcafe:react - displayName: "run functional tests" - -- job: Vue - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_vue_prod - displayName: "Build Vue" - - - script: | - npm run test:vue:single - displayName: "run markup tests" - - - bash: | - npm run testcafe:vue - displayName: "Vue functional tests" - -- job: Angular - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-angular-ui - npm install - displayName: "NPM install packages/survey-angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build - displayName: "Build Angular" - - - script: | - cd packages/survey-angular-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build:example - displayName: "Build Angular Example" - - - script: | - cd packages/survey-angular-ui - npm run test:single - displayName: "run unit and markup tests" - - - bash: | - npm run testcafe:ci:angular - displayName: "run functional tests" - -- job: Vue3 - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-vue3-ui - npm install - displayName: "NPM install packages/survey-vue3-ui" - - - script: | - cd packages/survey-vue3-ui - npm run build - displayName: "Build Vue3" - - - script: | - cd packages/survey-vue3-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd packages/survey-vue3-ui/example - npm run build - displayName: "Build Vue3 Example" - - - script: | - cd packages/survey-vue3-ui - npm run test:single - displayName: "run unit and markup tests" - - - bash: | - npm run testcafe:ci:vue3 - displayName: "run functional tests" - -# - job: JqueryUI -# steps: -# - checkout: self -# persistCredentials: true -# clean: true - -# - task: NodeTool@0 -# inputs: -# versionSpec: "16.x" -# displayName: "Install Node.js" - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: "$(Build.SourcesDirectory)/" -# Contents: "package.json" -# TargetFolder: "$(Build.SourcesDirectory)/Temp/" -# OverWrite: true -# displayName: "Copy package.json for cache key" -# - task: Cache@2 -# inputs: -# key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' -# path: $(Build.SourcesDirectory)/node_modules -# cacheHitVar: NPM_CACHE_RESTORED -# displayName: Cache NPM - -# - task: Npm@1 -# displayName: 'NPM install' -# inputs: -# command: install -# verbose: false -# workingDir: $(Build.SourcesDirectory) -# condition: ne(variables.NPM_CACHE_RESTORED, 'true') - -# - script: | -# npm run build_core -# npm run build_i18n -# npm run build-plugins -# displayName: "Build Core" - -# - script: | -# npm run build_jquery_ui_prod -# displayName: "Build jquery-ui" - -# - script: | -# npm run testcafe:jquery-ui:ci -# displayName: "run functional tests" - -- job: SurveyUI_and_CSSFrameworks - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - workingDir: $(Build.SourcesDirectory) - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - npm run build_js_ui_prod - displayName: "Build survey-js-ui" - - - bash: | - npm run testcafe:survey-js-ui:ci - displayName: "run functional tests" + - job: Core + steps: + - checkout: self + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npm run lint + displayName: "run lint command" + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - script: | + cd packages/survey-core + npm install + displayName: "NPM install packages/survey-core" + + - script: | + cd packages/survey-core + npm run build:all + displayName: "Build core" + + - script: | + cd packages/survey-core + npm test + displayName: "run unit test" + + - script: | + cd packages/survey-core + npm run test:postcss + displayName: "check postcss compatibility" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core" + ArtifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + publishLocation: "Container" + + - job: React + dependsOn: Core + steps: + - checkout: self + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-react-ui + npm install + displayName: "NPM install packages/survey-react-ui" + + - script: | + cd packages/survey-react-ui + npm run build + displayName: "Build React" + + - script: | + cd packages/survey-react-ui + npm run test + displayName: "run markup tests" + + - bash: | + cd packages/survey-react-ui + npm run testcafe:ci + displayName: "run functional tests" + + - job: Angular + dependsOn: Core + steps: + - checkout: self + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-angular-ui + npm install + displayName: "NPM install packages/survey-angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build + displayName: "Build Angular" + + - script: | + cd packages/survey-angular-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build:example:prod + displayName: "Build Angular Example" + + - script: | + cd packages/survey-angular-ui + npm run test + displayName: "run unit and markup tests" + + - bash: | + cd packages/survey-angular-ui + npm run testcafe:ci + displayName: "run functional tests" + + - job: Vue3 + dependsOn: Core + steps: + - checkout: self + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-vue3-ui + npm install + displayName: "NPM install packages/survey-vue3-ui" + + - script: | + cd packages/survey-vue3-ui + npm run build + displayName: "Build Vue3" + + - script: | + cd packages/survey-vue3-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-vue3-ui/example + npm run build + displayName: "Build Vue3 Example" + + - script: | + cd packages/survey-vue3-ui + npm run test + displayName: "run unit and markup tests" + + - bash: | + cd packages/survey-vue3-ui + npm run testcafe:ci + displayName: "run functional tests" + + - job: SurveyUI_and_CSSFrameworks + dependsOn: Core + steps: + - checkout: self + persistCredentials: true + clean: true + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory) + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-js-ui + npm install + displayName: "NPM install packages/survey-js-ui" + + - script: | + cd packages/survey-js-ui + npm run build + displayName: "Build UI" + + # - script: | + # cd packages/survey-js-ui + # npm run test + # displayName: "run markup tests" + + - bash: | + cd packages/survey-js-ui + npm run testcafe:ci + displayName: "run functional tests" diff --git a/devops-visual-regression-tests.yml b/devops-visual-regression-tests.yml index 0c3b0fa206..98f6eb5014 100644 --- a/devops-visual-regression-tests.yml +++ b/devops-visual-regression-tests.yml @@ -3,534 +3,410 @@ # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript - trigger: batch: true branches: exclude: - - master + - master tags: exclude: - v*.*.* pool: - vmImage: 'windows-latest' + vmImage: "windows-latest" jobs: -- job: Knockout - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_knockout_prod - displayName: 'build prod' - - - script: | - npm run visual-regression-tests:ci:knockout - displayName: 'Visual Regression Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Knockout_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Knockout_VRT/' - ArtifactName: 'Library_Knockout_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' - -- job: React - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_react_prod - npm run build_core - npm run build_i18n - npm run build-plugins - npm run build_react_ui - displayName: 'build prod' - - - script: | - npm run visual-regression-tests:ci:react - displayName: 'Visual Regression Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_React_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_React_VRT/' - ArtifactName: 'Library_React_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' - -- job: Vue - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_vue_prod - displayName: 'build prod' - - - script: | - npm run visual-regression-tests:ci:vue - displayName: 'Visual Regression Tests' - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue_VRT/' - ArtifactName: 'Library_Vue_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' - -- job: Angular - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-angular-ui - npm install - displayName: "NPM install packages/survey-angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build - displayName: "Build Angular" - - - script: | - cd packages/survey-angular-ui/example - npm install - displayName: "NPM install examples/angular-ui" - - - script: | - cd packages/survey-angular-ui - npm run build:example - displayName: "Build Angular Example" - - - script: | - npm run visual-regression-tests:ci:angular - displayName: "run vrt tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Angular_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Angular_VRT/' - ArtifactName: 'Library_Angular_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' - -- job: Vue3 - steps: - - checkout: self - persistCredentials: true - clean: true - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Install Node.js" - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPMs - - - task: Npm@1 - displayName: 'NPM install root' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - powershell: | - npm run build_core - npm run build_i18n_dev - npm run build-plugins - displayName: "Build Core" - - - script: | - cd packages/survey-vue3-ui - npm install - displayName: "NPM install packages/survey-vue3-ui" - - - script: | - cd packages/survey-vue3-ui - npm run build - displayName: "Build Vue3" - - - script: | - cd packages/survey-vue3-ui/example - npm install - displayName: "NPM install packages/survey-vue3-ui/example" - - - script: | - cd packages/survey-vue3-ui/example - npm run build - displayName: "Build Vue3 Example" - - - script: | - npm run visual-regression-tests:ci:vue3 - displayName: "run vrt tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_Vue3_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_Vue3_VRT/' - ArtifactName: 'Library_Vue3_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' - -# - job: JqueryUI -# steps: -# - checkout: self - -# - task: PowerShell@2 -# displayName: 'update Google Chrome to latest' -# inputs: -# targetType: 'inline' -# script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - -# - task: NodeTool@0 -# inputs: -# versionSpec: '16.x' -# displayName: 'Install Node.js' - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: "$(Build.SourcesDirectory)/" -# Contents: "package.json" -# TargetFolder: "$(Build.SourcesDirectory)/Temp/" -# OverWrite: true -# displayName: "Copy package.json for cache key" -# - task: Cache@2 -# inputs: -# key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' -# path: $(Build.SourcesDirectory)/node_modules -# cacheHitVar: NPM_CACHE_RESTORED -# displayName: Cache NPM - -# - task: Npm@1 -# displayName: 'NPM install' -# inputs: -# command: install -# verbose: false -# condition: ne(variables.NPM_CACHE_RESTORED, 'true') - -# - script: | -# npm run build_core -# npm run build_i18n -# npm run build-plugins -# displayName: "Build Core" - -# - script: | -# npm run build_jquery_ui_prod -# displayName: "Build jquery-ui" - -# - script: | -# npm run vrt:jquery-ui:ci -# displayName: "Visual Regression Tests" - -# - task: CopyFiles@2 -# inputs: -# SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' -# Contents: '**' -# TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_JqueryUI_VRT' -# OverWrite: true -# condition: always() -# displayName: 'copy vrt artifacts' - -# - task: PublishBuildArtifacts@1 -# inputs: -# PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_JqueryUI_VRT/' -# ArtifactName: 'Library_JqueryUI_VRT' -# publishLocation: 'Container' -# condition: always() -# displayName: 'publish vrt artifacts' - -- job: SurveyUI_and_CSSFrameworks - steps: - - checkout: self - - - task: PowerShell@2 - displayName: 'update Google Chrome to latest' - inputs: - targetType: 'inline' - script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer' - - - task: NodeTool@0 - inputs: - versionSpec: '16.x' - displayName: 'Install Node.js' - - - task: CopyFiles@2 - inputs: - SourceFolder: "$(Build.SourcesDirectory)/" - Contents: "package.json" - TargetFolder: "$(Build.SourcesDirectory)/Temp/" - OverWrite: true - displayName: "Copy package.json for cache key" - - task: Cache@2 - inputs: - key: 'npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json' - path: $(Build.SourcesDirectory)/node_modules - cacheHitVar: NPM_CACHE_RESTORED - displayName: Cache NPM - - - task: Npm@1 - displayName: 'NPM install' - inputs: - command: install - verbose: false - condition: ne(variables.NPM_CACHE_RESTORED, 'true') - - - - script: | - npx puppeteer browsers install chrome - displayName: "install chrome" - - - script: | - npm run build_core - npm run build_i18n - npm run build-plugins - displayName: "Build Core" - - - script: | - npm run build_js_ui_prod - displayName: "Build survey-js-ui" - - - script: | - npm run vrt:survey-js-ui:ci - displayName: "Visual Regression Tests" - - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Build.SourcesDirectory)/visualRegressionTests' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/Library_SurveyUI_VRT' - OverWrite: true - condition: always() - displayName: 'copy vrt artifacts' - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/Library_SurveyUI_VRT/' - ArtifactName: 'Library_JqueryUI_VRT' - publishLocation: 'Container' - condition: always() - displayName: 'publish vrt artifacts' + - job: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npm run lint + displayName: "run lint command" + + - script: | + cd packages/survey-core + npm install + displayName: "NPM install packages/survey-core" + + - script: | + cd packages/survey-core + npm run build:all + displayName: "Build core" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/SurveyJSLibraryBuild/build/survey-core" + ArtifactName: "SurveyJSLibraryBuildCore-VRT-$(Build.BuildId)" + publishLocation: "Container" + + - job: React + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-VRT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-VRT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-react-ui + npm install + displayName: "NPM install packages/survey-react-ui" + + - script: | + cd packages/survey-react-ui + npm run build + displayName: "Build React" + + - script: | + cd packages/survey-react-ui + npm run vrt:ci + displayName: "Visual Regression Tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/visualRegressionTests" + Contents: "**" + TargetFolder: "$(Build.ArtifactStagingDirectory)/Library_React_VRT" + OverWrite: true + condition: always() + displayName: "copy vrt artifacts" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/Library_React_VRT/" + ArtifactName: "Library_React_VRT" + publishLocation: "Container" + condition: always() + displayName: "publish vrt artifacts" + + - job: Angular + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-VRT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-VRT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-angular-ui + npm install + displayName: "NPM install packages/survey-angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build + displayName: "Build Angular" + + - script: | + cd packages/survey-angular-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-angular-ui + npm run build:example:prod + displayName: "Build Angular Example" + + - script: | + cd packages/survey-angular-ui + npm run vrt:ci + displayName: "Visual Regression Tests" + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/visualRegressionTests" + Contents: "**" + TargetFolder: "$(Build.ArtifactStagingDirectory)/Library_Angular_VRT" + OverWrite: true + condition: always() + displayName: "copy vrt artifacts" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/Library_Angular_VRT/" + ArtifactName: "Library_Angular_VRT" + publishLocation: "Container" + condition: always() + displayName: "publish vrt artifacts" + + - job: Vue3 + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPMs + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-VRT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-VRT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-vue3-ui + npm install + displayName: "NPM install packages/survey-vue3-ui" + + - script: | + cd packages/survey-vue3-ui + npm run build + displayName: "Build Vue3" + + - script: | + cd packages/survey-vue3-ui/example + npm install + displayName: "NPM install examples/angular-ui" + + - script: | + cd packages/survey-vue3-ui/example + npm run build + displayName: "Build Vue3 Example" + + - script: | + cd packages/survey-vue3-ui + npm run vrt:ci + displayName: "Visual Regression Tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/visualRegressionTests" + Contents: "**" + TargetFolder: "$(Build.ArtifactStagingDirectory)/Library_Vue_VRT" + OverWrite: true + condition: always() + displayName: "copy vrt artifacts" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/Library_Vue_VRT/" + ArtifactName: "Library_Vue_VRT" + publishLocation: "Container" + condition: always() + displayName: "publish vrt artifacts" + + - job: SurveyUI_and_CSSFrameworks + dependsOn: Core + steps: + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Install Node.js" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/" + Contents: "package.json" + TargetFolder: "$(Build.SourcesDirectory)/Temp/" + OverWrite: true + displayName: "Copy package.json for cache key" + - task: Cache@2 + inputs: + key: "npm-cache-library | $(Build.SourcesDirectory)/Temp/package.json" + path: $(Build.SourcesDirectory)/node_modules + cacheHitVar: NPM_CACHE_RESTORED + displayName: Cache NPM + + - task: Npm@1 + displayName: "NPM install root" + inputs: + command: install + verbose: false + workingDir: $(Build.SourcesDirectory) + condition: ne(variables.NPM_CACHE_RESTORED, 'true') + + - script: | + npx puppeteer browsers install chrome + displayName: "install chrome" + + - task: DownloadBuildArtifacts@0 + inputs: + buildType: "current" + downloadType: "single" + artifactName: "SurveyJSLibraryBuildCore-VRT-$(Build.BuildId)" + downloadPath: "$(System.ArtifactsDirectory)" + + - task: CopyFiles@2 + inputs: + SourceFolder: $(System.ArtifactsDirectory)/SurveyJSLibraryBuildCore-VRT-$(Build.BuildId) + TargetFolder: "$(Build.SourcesDirectory)/packages/survey-core/build" + + - script: | + cd packages/survey-js-ui + npm install + displayName: "NPM install packages/survey-js-ui" + + - script: | + cd packages/survey-js-ui + npm run build + displayName: "Build UI" + + - script: | + cd packages/survey-js-ui + npm run vrt:ci + displayName: "Visual Regression Tests" + + - task: CopyFiles@2 + inputs: + SourceFolder: "$(Build.SourcesDirectory)/visualRegressionTests" + Contents: "**" + TargetFolder: "$(Build.ArtifactStagingDirectory)/Library_SurveyUI_VRT" + OverWrite: true + condition: always() + displayName: "copy vrt artifacts" + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: "$(Build.ArtifactStagingDirectory)/Library_SurveyUI_VRT/" + ArtifactName: "Library_JqueryUI_VRT" + publishLocation: "Container" + condition: always() + displayName: "publish vrt artifacts" diff --git a/examples_test/bootstrap/jquery-ui.html b/examples_test/bootstrap/jquery-ui.html deleted file mode 100644 index bed7bc6ffa..0000000000 --- a/examples_test/bootstrap/jquery-ui.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/bootstrap/knockout.html b/examples_test/bootstrap/knockout.html deleted file mode 100644 index 7141b8b343..0000000000 --- a/examples_test/bootstrap/knockout.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/bootstrap/react.html b/examples_test/bootstrap/react.html deleted file mode 100644 index a4b8f59efd..0000000000 --- a/examples_test/bootstrap/react.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/bootstrap/survey-js-ui.html b/examples_test/bootstrap/survey-js-ui.html deleted file mode 100644 index 46b54901b0..0000000000 --- a/examples_test/bootstrap/survey-js-ui.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/bootstrap/vue.html b/examples_test/bootstrap/vue.html deleted file mode 100644 index 931270f768..0000000000 --- a/examples_test/bootstrap/vue.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/default/index.js b/examples_test/default/index.js deleted file mode 100644 index aa3989b88f..0000000000 --- a/examples_test/default/index.js +++ /dev/null @@ -1,6 +0,0 @@ -function init() { - //disable observer for survey to prevent loop limited exceptions - Survey.defaultStandardCss.variables.mobileWidth = undefined; - Survey.StylesManager.applyTheme("default"); -} -document.addEventListener("DOMContentLoaded", init); \ No newline at end of file diff --git a/examples_test/default/jquery-ui.html b/examples_test/default/jquery-ui.html deleted file mode 100644 index dfdf3cc80b..0000000000 --- a/examples_test/default/jquery-ui.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/default/knockout.html b/examples_test/default/knockout.html deleted file mode 100644 index b396339592..0000000000 --- a/examples_test/default/knockout.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/default/react.html b/examples_test/default/react.html deleted file mode 100644 index edeaa7845c..0000000000 --- a/examples_test/default/react.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - -
-
- - diff --git a/examples_test/default/survey-js-ui.html b/examples_test/default/survey-js-ui.html deleted file mode 100644 index fbd88a6542..0000000000 --- a/examples_test/default/survey-js-ui.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/default/vue.html b/examples_test/default/vue.html deleted file mode 100644 index a50a54d369..0000000000 --- a/examples_test/default/vue.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - -
- -
-
- - diff --git a/examples_test/modern/index.js b/examples_test/modern/index.js deleted file mode 100644 index 48fb83e222..0000000000 --- a/examples_test/modern/index.js +++ /dev/null @@ -1,5 +0,0 @@ -function init() { - //disable observer for survey to prevent loop limited exceptions - Survey.modernCss.variables.mobileWidth = undefined; -} -document.addEventListener("DOMContentLoaded", init); \ No newline at end of file diff --git a/examples_test/modern/jquery-ui.html b/examples_test/modern/jquery-ui.html deleted file mode 100644 index de22fa9036..0000000000 --- a/examples_test/modern/jquery-ui.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/modern/knockout.html b/examples_test/modern/knockout.html deleted file mode 100644 index 1eba5627ee..0000000000 --- a/examples_test/modern/knockout.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/modern/react.html b/examples_test/modern/react.html deleted file mode 100644 index d096174507..0000000000 --- a/examples_test/modern/react.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - -
-
- - diff --git a/examples_test/modern/survey-js-ui.html b/examples_test/modern/survey-js-ui.html deleted file mode 100644 index 035f0e5603..0000000000 --- a/examples_test/modern/survey-js-ui.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/examples_test/modern/vue.html b/examples_test/modern/vue.html deleted file mode 100644 index d070dc3262..0000000000 --- a/examples_test/modern/vue.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/testCafe/components/list.ts b/functionalTests/components/list.ts similarity index 98% rename from testCafe/components/list.ts rename to functionalTests/components/list.ts index 76d1285225..1725756005 100644 --- a/testCafe/components/list.ts +++ b/functionalTests/components/list.ts @@ -59,7 +59,7 @@ const popupSelector = Selector(".sv-popup .sv-popup__container").filterVisible() const visibleItems = Selector(".sv-list__item").filterVisible(); const listInput = popupSelector.find(".sv-list__input"); function getActionByText(text: string) { - return Selector(".sv-action-bar-item__title").withText(text); + return Selector(".sd-action__title").withText(text); } frameworks.forEach(async framework => { diff --git a/testCafe/components/popup.ts b/functionalTests/components/popup.ts similarity index 93% rename from testCafe/components/popup.ts rename to functionalTests/components/popup.ts index ad7b1893bd..64bc899100 100644 --- a/testCafe/components/popup.ts +++ b/functionalTests/components/popup.ts @@ -104,7 +104,7 @@ function addDropdownActionWithSubItems(_, opt) { const popupSelector = Selector(".sv-popup .sv-popup__container"); const popupModalSelector = Selector(".sv-popup.sv-popup--modal"); -const clickButton = Selector(".sv-action-bar-item"); +const clickButton = Selector(".sd-action"); const popupButtonSelector = Selector(".sv-popup__button"); frameworks.forEach(async framework => { @@ -123,7 +123,7 @@ frameworks.forEach(async framework => { .expect(Selector(".sv-popup span").withText("Item 1").visible).ok(); const popupClientRect = await getElementClientRect(".sv-popup__container"); - const itemClientRect = await getElementClientRect(".sv-action-bar-item"); + const itemClientRect = await getElementClientRect(".sd-action"); await t .expect(Math.round(itemClientRect.left) - 8 - Math.round(popupClientRect.width)).eql(Math.round(popupClientRect.left)) @@ -133,11 +133,11 @@ frameworks.forEach(async framework => { .expect(popupSelector.visible).notOk() .click(clickButton) .expect(popupSelector.visible).ok() - .expect(Selector(".sv-action-bar-item").hasClass("sv-action-bar-item--pressed")).ok() + .expect(Selector(".sd-action").hasClass("sd-action--pressed")).ok() .pressKey("esc") .expect(popupSelector.exists).ok() .expect(popupSelector.visible).notOk() - .expect(Selector(".sv-action-bar-item").hasClass("sv-action-bar-item--pressed")).notOk() + .expect(Selector(".sd-action").hasClass("sd-action--pressed")).notOk() .click(clickButton) .expect(popupSelector.visible).ok() .click(Selector("body"), { @@ -163,7 +163,7 @@ frameworks.forEach(async framework => { })(); let popupClientRect = await getElementClientRect(".sv-popup__container"); - let itemClientRect = await getElementClientRect(".sv-action-bar-item"); + let itemClientRect = await getElementClientRect(".sd-action"); await t .expect(Math.round(itemClientRect.left) - 8 - Math.round(popupClientRect.width)).eql(Math.round(popupClientRect.left)) .expect(Math.round(itemClientRect.top)).eql(Math.round(popupClientRect.top)); @@ -185,7 +185,7 @@ frameworks.forEach(async framework => { .expect(Selector(".sv-popup span").withText("Item 1").visible).ok(); const popupClientRect = await getElementClientRect(".sv-popup__container"); - const itemClientRect = await getElementClientRect(".sv-action-bar-item"); + const itemClientRect = await getElementClientRect(".sd-action"); const popupPointerClientRect = await getElementClientRect(".sv-popup__pointer"); await t @@ -200,10 +200,11 @@ frameworks.forEach(async framework => { .expect(popupModalSelector.exists).notOk() .click(clickButton) .expect(popupModalSelector.visible).ok() - .expect(Selector(".sv-popup span").withText("modal_question").visible).ok(); - + .expect(Selector(".sv-popup span").withText("modal_question").visible).ok() + .wait(500); const popupClientRect = await getElementClientRect(".sv-popup--modal .sv-popup__container"); - const calcTop = Math.round((600 / 2 - popupClientRect.height / 2) * 10) / 10; + const paddingDiff = 32; //padding top and bottom diff of sv-popup container + const calcTop = Math.round((600/ 2 - paddingDiff / 2 - popupClientRect.height / 2) * 10) / 10; const calcLeft = Math.round((800 / 2 - popupClientRect.width / 2) * 10) / 10; await t .expect(Math.abs(popupClientRect.left - calcLeft)).lte(0.1) @@ -226,13 +227,13 @@ frameworks.forEach(async framework => { test("check focus trap", async t => { await initSurvey(framework, json, { onGetQuestionTitleActions: addModalPopupTitleAction }); - const inputInPopup = Selector(".sv-popup .sv_q_text_root"); + const inputInPopup = Selector(".sv-popup .sd-text"); await t - .click(Selector(".sv-action-bar-item")) + .click(Selector(".sd-action")) .expect(inputInPopup.focused).ok({ timeout: 100 }) .pressKey("tab") - .expect(Selector(".sv-popup .sv_complete_btn").focused).ok() + .expect(Selector(".sv-popup .sd-navigation__complete-btn").focused).ok() .pressKey("tab") .expect(popupButtonSelector.withText("Cancel").focused).ok() .pressKey("tab") @@ -246,7 +247,7 @@ frameworks.forEach(async framework => { test("check focus safekeeping", async t => { await initSurvey(framework, json, { onGetQuestionTitleActions: addModalPopupTitleAction }); - const inputInPopup = Selector(".sv-popup .sv_q_text_root"); + const inputInPopup = Selector(".sv-popup .sd-text"); await t .expect(clickButton.focused).notOk() @@ -314,8 +315,9 @@ frameworks.forEach(async framework => { await initSurvey(framework, json, { onGetQuestionTitleActions: currentAddDropdownTitleAction }); await t - .pressKey("shift+tab shift+tab") + .pressKey("shift+tab") .pressKey("enter") + .wait(500) .expect(popupSelector.visible).ok() .expect(listItems.count).eql(10) @@ -357,14 +359,15 @@ frameworks.forEach(async framework => { await t .click(clickButton) .expect(popupSelector.visible).ok() - .expect(popupSelector.offsetHeight).eql(346) + .expect(popupSelector.offsetHeight).eql(304) .click(clickButton) .expect(popupSelector.visible).notOk() .click(clickButton) .expect(popupSelector.visible).ok() - .expect(popupSelector.offsetHeight).eql(346); + .expect(popupSelector.offsetHeight).eql(304); }); test("check popup with filter", async t => { + await t.resizeWindow(800, 800); const currentAddDropdownTitleAction = (_, opt) => { if (opt.question.name !== "actions_question") return; @@ -403,7 +406,7 @@ frameworks.forEach(async framework => { ] }, { onGetQuestionTitleActions: currentAddDropdownTitleAction }); - const popupHeight = 455; + const popupHeight = 672; await t .click(clickButton) .expect(popupSelector.visible).ok() @@ -411,6 +414,7 @@ frameworks.forEach(async framework => { .typeText(Selector(".sv-list__input"), "2") .expect(popupSelector.offsetHeight).within(popupHeight - 1, popupHeight + 1) .click(clickButton) + .wait(500) .expect(popupSelector.visible).notOk() .click(clickButton) .expect(popupSelector.visible).ok() @@ -438,7 +442,8 @@ frameworks.forEach(async framework => { const listItems = Selector(".sv-list__item").filterVisible(); await t - .click(Selector(".sv-action-bar-item")) + .click(Selector(".sd-action")) + .wait(500) .expect(listItems.count).eql(40) .pressKey("1") @@ -465,7 +470,7 @@ frameworks.forEach(async framework => { .expect(item5Subitems.visible).notOk() .expect(item6Subitems.visible).notOk() - .click(Selector(".sv-action-bar-item")) // show action popup + .click(Selector(".sd-action")) // show action popup .expect(titlePopup.visible).ok() .expect(item5Subitems.visible).notOk() .expect(item6Subitems.visible).notOk() diff --git a/testCafe/conditionsAndTriggers/completeTrigger.js b/functionalTests/conditionsAndTriggers/completeTrigger.js similarity index 100% rename from testCafe/conditionsAndTriggers/completeTrigger.js rename to functionalTests/conditionsAndTriggers/completeTrigger.js diff --git a/testCafe/conditionsAndTriggers/requiredIf.ts b/functionalTests/conditionsAndTriggers/requiredIf.ts similarity index 87% rename from testCafe/conditionsAndTriggers/requiredIf.ts rename to functionalTests/conditionsAndTriggers/requiredIf.ts index 27dded5c83..7351b01780 100644 --- a/testCafe/conditionsAndTriggers/requiredIf.ts +++ b/functionalTests/conditionsAndTriggers/requiredIf.ts @@ -1,9 +1,7 @@ -import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; +import { frameworks, initSurvey, url } from "../helper"; import { Selector, ClientFunction } from "testcafe"; const title = "RequiredIf property"; -const themeName = "defaultV2"; - const json = { elements: [ { type: "radiogroup", name: "a", choices: ["item1", "item2", "item3"] }, @@ -19,9 +17,8 @@ const json = { frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}` + .page`${url}${framework}` .beforeEach(async (t) => { - await applyTheme(themeName); await initSurvey(framework, json); await t.resizeWindow(1000, 1000); }); diff --git a/testCafe/conditionsAndTriggers/setValueTrigger.js b/functionalTests/conditionsAndTriggers/setValueTrigger.js similarity index 96% rename from testCafe/conditionsAndTriggers/setValueTrigger.js rename to functionalTests/conditionsAndTriggers/setValueTrigger.js index 6fa32910fe..d5e908ab52 100644 --- a/testCafe/conditionsAndTriggers/setValueTrigger.js +++ b/functionalTests/conditionsAndTriggers/setValueTrigger.js @@ -93,7 +93,7 @@ frameworks.forEach((framework) => { await t .click("input[value=\"Yes\"]") .click("input[value=\"Complete\"]") - .expect(Selector(".sv_completed_page").textContent).contains("Jon Snow"); + .expect(Selector(".sd-completedpage").textContent).contains("Jon Snow"); const surveyResult = await getSurveyResult(); await t.expect(surveyResult).eql({ diff --git a/testCafe/conditionsAndTriggers/visibleIf.js b/functionalTests/conditionsAndTriggers/visibleIf.js similarity index 97% rename from testCafe/conditionsAndTriggers/visibleIf.js rename to functionalTests/conditionsAndTriggers/visibleIf.js index 863b8e5947..718d9e23ca 100644 --- a/testCafe/conditionsAndTriggers/visibleIf.js +++ b/functionalTests/conditionsAndTriggers/visibleIf.js @@ -75,7 +75,7 @@ frameworks.forEach(framework => { } ); - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); + const questionDropdownSelect = Selector(".sd-dropdown"); test("check visibility", async t => { await t diff --git a/testCafe/conditionsAndTriggers/visibleTrigger.js b/functionalTests/conditionsAndTriggers/visibleTrigger.js similarity index 100% rename from testCafe/conditionsAndTriggers/visibleTrigger.js rename to functionalTests/conditionsAndTriggers/visibleTrigger.js diff --git a/testCafe/countriesMock.json b/functionalTests/countriesMock.json similarity index 100% rename from testCafe/countriesMock.json rename to functionalTests/countriesMock.json diff --git a/testCafe/customWidgets/icheckmatrix.js b/functionalTests/customWidgets/icheckmatrix.js similarity index 98% rename from testCafe/customWidgets/icheckmatrix.js rename to functionalTests/customWidgets/icheckmatrix.js index a7503e36b7..40f2e334bf 100644 --- a/testCafe/customWidgets/icheckmatrix.js +++ b/functionalTests/customWidgets/icheckmatrix.js @@ -33,6 +33,7 @@ const json = { frameworks.forEach(framework => { fixture`${framework} ${title}` .page`${url_test}customWidget/${framework}`.beforeEach(async ctx => { + await ctx.debug(); await initSurvey(framework, json); }); diff --git a/testCafe/customWidgets/sortablejs.js b/functionalTests/customWidgets/sortablejs.js similarity index 100% rename from testCafe/customWidgets/sortablejs.js rename to functionalTests/customWidgets/sortablejs.js diff --git a/testCafe/dxService/getSurveyResult.js b/functionalTests/dxService/getSurveyResult.js similarity index 100% rename from testCafe/dxService/getSurveyResult.js rename to functionalTests/dxService/getSurveyResult.js diff --git a/testCafe/dxService/loadSurvey.js b/functionalTests/dxService/loadSurvey.js similarity index 100% rename from testCafe/dxService/loadSurvey.js rename to functionalTests/dxService/loadSurvey.js diff --git a/testCafe/dxService/runSurveyOneTime.js b/functionalTests/dxService/runSurveyOneTime.js similarity index 97% rename from testCafe/dxService/runSurveyOneTime.js rename to functionalTests/dxService/runSurveyOneTime.js index 182bf96390..5db4cdafdb 100644 --- a/testCafe/dxService/runSurveyOneTime.js +++ b/functionalTests/dxService/runSurveyOneTime.js @@ -83,7 +83,7 @@ const initSurvey = ClientFunction(framework => { "surveyElement" ); survey.clientId = document.getElementById("clientId").value; - survey.sendResultOnPageNext = document.getElementById( + survey.partialSendEnabled = document.getElementById( "sendResultOnPageNext" ).checked; survey.onComplete.add(function(s) { @@ -111,7 +111,7 @@ const initSurvey = ClientFunction(framework => { clientId: document.getElementById("clientId").value }); document.getElementById("clientIdContainer").style.display = "none"; - survey.sendResultOnPageNext = document.getElementById( + survey.partialSendEnabled = document.getElementById( "sendResultOnPageNext" ).checked; window["ReactDOMClient"].createRoot(document.getElementById("surveyElement")).render( @@ -132,7 +132,7 @@ const initSurvey = ClientFunction(framework => { "surveyContainer" ); survey.clientId = document.getElementById("clientId").value; - survey.sendResultOnPageNext = document.getElementById( + survey.partialSendEnabled = document.getElementById( "sendResultOnPageNext" ).checked; survey.onComplete.add(surveyComplete); diff --git a/testCafe/dxService/saveSurveyResult.js b/functionalTests/dxService/saveSurveyResult.js similarity index 100% rename from testCafe/dxService/saveSurveyResult.js rename to functionalTests/dxService/saveSurveyResult.js diff --git a/testCafe/helper.js b/functionalTests/helper.js similarity index 98% rename from testCafe/helper.js rename to functionalTests/helper.js index 54388ee824..35fc336619 100644 --- a/testCafe/helper.js +++ b/functionalTests/helper.js @@ -11,15 +11,11 @@ export const frameworks = environment : ["knockout", "react", "vue"/*, "jquery-ui"*/]; // eslint-disable-next-line no-console console.log("Frameworks: " + frameworks.join(", ")); -export const url = "http://127.0.0.1:8080/examples_test/default/"; +export const url = "http://127.0.0.1:8080/examples_test/defaultV2/"; export const urlV2 = "http://127.0.0.1:8080/examples_test/defaultV2/"; export const url_test = "http://127.0.0.1:8080/examples_test/"; export const FLOAT_PRECISION = 0.01; -export const applyTheme = ClientFunction((theme) => { - window["Survey"].StylesManager.applyTheme(theme); -}); - export const initSurvey = ClientFunction( (framework, json, events, isDesignMode, props) => { // eslint-disable-next-line no-console @@ -524,7 +520,7 @@ export function getListItemByText(text) { .withText(text) .filterVisible(); } -export var completeButton = Selector(".sv_complete_btn"); +export var completeButton = Selector(".sd-navigation__complete-btn"); export const explicitErrorHandler = ClientFunction(() => { window.addEventListener("error", e => { diff --git a/testCafe/questions/allTypes.js b/functionalTests/questions/allTypes.js similarity index 58% rename from testCafe/questions/allTypes.js rename to functionalTests/questions/allTypes.js index 18042e35b8..6756b91b36 100644 --- a/testCafe/questions/allTypes.js +++ b/functionalTests/questions/allTypes.js @@ -1,4 +1,4 @@ -import { frameworks, url_test, initSurvey, getSurveyResult, getDynamicPanelRemoveButton, applyTheme, getListItemByText } from "../helper"; +import { frameworks, url, initSurvey, getSurveyResult, getDynamicPanelRemoveButton, getListItemByText } from "../helper"; import { Selector, fixture, test } from "testcafe"; const title = "allTypes"; @@ -148,159 +148,155 @@ var json = { ], }; -["modern", "bootstrap"].forEach(theme => { - frameworks.forEach(framework => { - fixture`${framework} ${title} ${theme}` - .page`${url_test}${theme}/${framework}`.beforeEach(async t => { - await applyTheme(theme); - await initSurvey(framework, json); - }); - test("check survey will all types", async t => { - await t - .expect(Selector(".sv-string-editor").exists) - .notOk("There should not be any editable elements outside design mode"); - - await t.typeText( - Selector("span").withText("text_question") - .parent("[data-name]") - .find("input"), - "test text" - ); +frameworks.forEach(framework => { + fixture`${framework} ${title}` + .page`${url}${framework}`.beforeEach(async t => { + await initSurvey(framework, json); + }); + test("check survey will all types", async t => { + await t + .expect(Selector(".sv-string-editor").exists) + .notOk("There should not be any editable elements outside design mode"); - await t.click( - Selector("span").withText("checkbox_question") - .parent("[data-name]") - .find("span") - .withText("item1") - ); + await t.typeText( + Selector("span").withText("text_question") + .parent("[data-name]") + .find("input"), + "test text" + ); - await t.click( - Selector("span").withText("radiogroup_question") - .parent("[data-name]") - .find("span") - .withText("item1") - ); + await t.click( + Selector("span").withText("checkbox_question") + .parent("[data-name]") + .find("span") + .withText("item1") + ); - await t - .click(Selector("div[aria-label='dropdown_question']")) - .click(getListItemByText("item1")); + await t.click( + Selector("span").withText("radiogroup_question") + .parent("[data-name]") + .find("span") + .withText("item1") + ); - await t.typeText( - Selector("span").withText("comment_question") - .parent("[data-name]") - .find("textarea"), - "test comment" - ); + await t + .click(Selector("div[aria-label='dropdown_question']")) + .click(getListItemByText("item1")); - await t.click( - Selector("span").withText("rating_question") - .parent("[data-name]") - .find("span") - .withText("3") - ); + await t.typeText( + Selector("span").withText("comment_question") + .parent("[data-name]") + .find("textarea"), + "test comment" + ); - await t.click( - Selector("span").withText("imagepicker_question") - .parent("[data-name]") - .find("img") - .withAttribute("alt", "item1") - .parent() - ); + await t.click( + Selector("span").withText("rating_question") + .parent("[data-name]") + .find("span") + .withText("3") + ); - await t.click( - Selector("span").withText("boolean_question") - .parent("[data-name]") - .find("span") - .withText("Yes") - ); + await t.click( + Selector("span").withText("imagepicker_question") + .parent("[data-name]") + .find("img") + .withAttribute("alt", "item1") + .parent() + ); - await t.hover(Selector("[data-name='image_question']").find("img")); + await t.click( + Selector("span").withText("boolean_question") + .parent("[data-name]") + .find("span") + .withText("Yes") + ); - await t.expect(Selector(".sjs-html-question").innerText).eql("html text"); + await t.hover(Selector("[data-name='image_question']").find("img")); - await t.click( - Selector("span").withText("signature_question") - .parent("[data-name]") - .find("button") - .withAttribute("title", "Clear") - ); + await t.expect(Selector(".sjs-html-question").innerText).eql("html text"); - await t.hover( - Selector("span").withText("expression_question") - .parent("[data-name]") - .find("div") - .withText("1") - ); + await t.click( + Selector("span").withText("signature_question") + .parent("[data-name]") + .find("button") + .withAttribute("title", "Clear") + ); - await t.click( - Selector("span").withText("file_question") - .parent("[data-name]") - .find("button") - .withText("Clear") - .filterVisible() - ); + await t.hover( + Selector("span").withText("expression_question") + .parent("[data-name]") + .find("div") + .withText("1") + ); - await t.click( - Selector("span").withText("matrix_question") - .parent("[data-name]") - .find("tr") - .withText("Row 1") - .find("input[type='radio']") - .parent() - ); + await t.click( + Selector("span").withText("file_question") + .parent("[data-name]") + .find("button") + .withText("Clear") + .filterVisible() + ); - const matrixDropdownRow = Selector("span").withText("matrixdropdown_question") + await t.click( + Selector("span").withText("matrix_question") .parent("[data-name]") - .find("tr").withText("Row 1"); - await t - .click(matrixDropdownRow.find("div[aria-label='row Row 1, column Column 1']")) - .click(getListItemByText("1")); + .find("tr") + .withText("Row 1") + .find("input[type='radio']") + .parent() + ); - await t.click( - Selector("span").withText("matrixdynamic_question") - .parent("[data-name]") - .find("span") - .withText("Remove") - ); + const matrixDropdownRow = Selector("span").withText("matrixdropdown_question") + .parent("[data-name]") + .find("tr").withText("Row 1"); + await t + .click(matrixDropdownRow.find("div[aria-label='row Row 1, column Column 1']")) + .click(getListItemByText("1")); + await t.click( + Selector("span").withText("matrixdynamic_question") + .parent("[data-name]") + .find("button") + .withAttribute("title", "Remove") + ); - await t.typeText( - Selector("span").withText("multipletext_question") - .parent("[data-name]") - .find("input"), - "test multiple text" - ); + await t.typeText( + Selector("span").withText("multipletext_question") + .parent("[data-name]") + .find("input"), + "test multiple text" + ); - await t.click(Selector("span").withText("panel_title")); + await t.click(Selector("span").withText("panel_title")); - await t.click(getDynamicPanelRemoveButton("paneldynamic", "Remove")); + await t.click(getDynamicPanelRemoveButton("paneldynamic", "Remove")); - // const rankItem1 = Selector("span").withText('ranking_question') - // .parent("[data-name]") - // .find("div")W - // .withText("item1"); + // const rankItem1 = Selector("span").withText('ranking_question') + // .parent("[data-name]") + // .find("div")W + // .withText("item1"); - // const rankItem2 = Selector("span").withText('ranking_question') - // .parent("[data-name]") - // .find("div") - // .withText("item2"); - // await t.dragToElement(rankItem1, rankItem2, { destinationOffsetY: -1, speed: 0.1 }); + // const rankItem2 = Selector("span").withText('ranking_question') + // .parent("[data-name]") + // .find("div") + // .withText("item2"); + // await t.dragToElement(rankItem1, rankItem2, { destinationOffsetY: -1, speed: 0.1 }); - await t.click("input[value=Complete]"); + await t.click("input[value=Complete]"); - const surveyResult = await getSurveyResult(); - await t.expect(surveyResult.text_question).eql("test text"); - await t.expect(surveyResult.checkbox_question).eql(["item1"]); - await t.expect(surveyResult.radiogroup_question).eql("item1"); - await t.expect(surveyResult.dropdown_question).eql("item1"); - await t.expect(surveyResult.comment_question).eql("test comment"); - await t.expect(surveyResult.rating_question).eql(3); - await t.expect(surveyResult.imagepicker_question).eql("item1"); - await t.expect(surveyResult.boolean_question).eql(true); - await t.expect(surveyResult.expression_question).eql(1); - await t.expect(surveyResult.matrix_question).eql({ "Row 1": "Column 1", }); - await t.expect(surveyResult.matrixdropdown_question).eql({ "Row 1": { "Column 1": 1, }, }); - await t.expect(surveyResult.multipletext_question).eql({ text1: "test multiple text", }); - // await t.expect(surveyResult.ranking_question).eql(["item2", "item1"]); - }); + const surveyResult = await getSurveyResult(); + await t.expect(surveyResult.text_question).eql("test text"); + await t.expect(surveyResult.checkbox_question).eql(["item1"]); + await t.expect(surveyResult.radiogroup_question).eql("item1"); + await t.expect(surveyResult.dropdown_question).eql("item1"); + await t.expect(surveyResult.comment_question).eql("test comment"); + await t.expect(surveyResult.rating_question).eql(3); + await t.expect(surveyResult.imagepicker_question).eql("item1"); + await t.expect(surveyResult.boolean_question).eql(true); + await t.expect(surveyResult.expression_question).eql(1); + await t.expect(surveyResult.matrix_question).eql({ "Row 1": "Column 1", }); + await t.expect(surveyResult.matrixdropdown_question).eql({ "Row 1": { "Column 1": 1, }, }); + await t.expect(surveyResult.multipletext_question).eql({ text1: "test multiple text", }); + // await t.expect(surveyResult.ranking_question).eql(["item2", "item1"]); }); }); diff --git a/testCafe/questions/boolean.js b/functionalTests/questions/boolean.js similarity index 89% rename from testCafe/questions/boolean.js rename to functionalTests/questions/boolean.js index 0eb0af84ce..2d23ae4cf5 100644 --- a/testCafe/questions/boolean.js +++ b/functionalTests/questions/boolean.js @@ -1,4 +1,4 @@ -import { frameworks, url, url_test, initSurvey, getQuestionValue, getQuestionJson, applyTheme } from "../helper"; +import { frameworks, url, initSurvey, getQuestionValue, getQuestionJson } from "../helper"; import { ClientFunction, Selector, fixture, test } from "testcafe"; const title = "boolean"; @@ -58,20 +58,20 @@ frameworks.forEach((framework) => { test("checked class", async (t) => { const label = Selector("div label"); await t - .expect(label.classNames).notContains("checked") + .expect(label.classNames).notContains("sd-boolean--checked") - .click("div label", { offsetX: 1 }) - .expect(label.classNames).notContains("checked") + .click("div label", { offsetX: 4 }) + .expect(label.classNames).notContains("sd-boolean--checked") .click("div label") - .expect(label.classNames).contains("checked"); + .expect(label.classNames).contains("sd-boolean--checked"); }); test("click on true label in intermediate state", async (t) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - await t.click(Selector(".sv-boolean__thumb-ghost").nth(1)); + await t.click(Selector(".sd-boolean__thumb-ghost").nth(1)); questionValue = await getQuestionValue(); await t.expect(questionValue).eql(true); @@ -81,7 +81,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - await t.click(".sv-boolean__label:first-of-type"); + await t.click(".sd-boolean__label:first-of-type"); questionValue = await getQuestionValue(); await t.expect(questionValue).eql(false); @@ -90,9 +90,7 @@ frameworks.forEach((framework) => { test("click on right side of switch in intermediate state", async (t) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - - await t.click(".sv-boolean__switch", { offsetX: -1 }); - + await t.click(Selector(".sd-boolean"), { offsetX: -4 }); questionValue = await getQuestionValue(); await t.expect(questionValue).eql(true); }); @@ -100,15 +98,13 @@ frameworks.forEach((framework) => { test("click on left side of switch in intermediate state", async (t) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - - await t.click(".sv-boolean__switch", { offsetX: 1 }); - + await t.click(Selector(".sd-boolean"), { offsetX: 4 }); questionValue = await getQuestionValue(); await t.expect(questionValue).eql(false); }); test("check arrow keydowns", async (t) => { - await ClientFunction(() => { document.querySelector(".sv-boolean input").focus(); })(); + await ClientFunction(() => { document.querySelector(".sd-boolean input").focus(); })(); await t .expect(getQuestionValue()).eql(undefined) .pressKey("right") @@ -131,7 +127,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -153,7 +149,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = Selector(".sv-boolean__label").nth(1); + var outerSelector = Selector(".sd-boolean__label").nth(1); await t .click(outerSelector) .typeText(outerSelector.find(".sv-string-editor"), newLabelTrue, { replace: true }) @@ -175,7 +171,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = ".sv-boolean__label:nth-of-type(1)"; + var outerSelector = ".sd-boolean__label:nth-of-type(1)"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -196,7 +192,7 @@ frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`; test("check first clink on boolean-checkbox input", async (t) => { await initSurvey(framework, jsonCheckbox); - const selector = Selector(".sv_qbln input"); + const selector = Selector(".sd-selectbase input"); await t .click(selector) .expect(selector.checked).ok(); @@ -216,12 +212,10 @@ frameworks.forEach((framework) => { }); }); frameworks.forEach((framework) => { - const theme = "defaultV2"; - fixture`${framework} ${title} ${theme}` - .page`${url_test}${theme}/${framework}`; + fixture`${framework} ${title}` + .page`${url}${framework}`; test("Check actions", async (t) => { - await applyTheme(theme); await initSurvey(framework, jsonCheckbox2, { onGetQuestionTitleActions: (_, options) => { options.titleActions = [ { @@ -254,7 +248,6 @@ frameworks.forEach((framework) => { return window["survey"].getQuestionByName("q").value == val; } ); - await applyTheme(theme); await initSurvey(framework, { "elements": [{ "type": "boolean", diff --git a/testCafe/questions/buttongroup.js b/functionalTests/questions/buttongroup.js similarity index 100% rename from testCafe/questions/buttongroup.js rename to functionalTests/questions/buttongroup.js diff --git a/testCafe/questions/checkboxes.js b/functionalTests/questions/checkboxes.js similarity index 85% rename from testCafe/questions/checkboxes.js rename to functionalTests/questions/checkboxes.js index 2e901214cd..93bef1579e 100644 --- a/testCafe/questions/checkboxes.js +++ b/functionalTests/questions/checkboxes.js @@ -1,9 +1,12 @@ -import { frameworks, url, url_test, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, applyTheme, getData } from "../helper"; +import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, getData } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; // eslint-disable-next-line no-undef const assert = require("assert"); const title = "checkboxes"; +const columnClassName = ".sd-selectbase__column"; +const checkboxControlClassName = ".sd-checkbox__control"; + const json = { elements: [ { @@ -30,7 +33,7 @@ const json = { }, ], }; - +const controlLabelSelector = Selector(".sd-item__control-label"); frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (ctx) => { @@ -41,15 +44,14 @@ frameworks.forEach((framework) => { test("choose empty", async (t) => { await checkSurveyWithEmptyQuestion(t); }); - test("choose none", async (t) => { let surveyResult; await t - .click(Selector(".sv_q_checkbox_control_label").withText("Nissan")) - .click(Selector(".sv_q_checkbox_control_label").withText("Audi")) - .click(Selector(".sv_q_checkbox_control_label").withText("Vauxhall")) - .click(Selector(".sv_q_checkbox_control_label").withText("None")) + .click(controlLabelSelector.withText("Nissan")) + .click(controlLabelSelector.withText("Audi")) + .click(controlLabelSelector.withText("Vauxhall")) + .click(controlLabelSelector.withText("None")) .click("input[value=Complete]"); surveyResult = await getSurveyResult(); @@ -60,7 +62,7 @@ frameworks.forEach((framework) => { let surveyResult; await t - .click(Selector(".sv_q_checkbox_control_label").withText("Nissan")) + .click(controlLabelSelector.withText("Nissan")) .click("input[value=Complete]"); surveyResult = await getSurveyResult(); @@ -71,8 +73,8 @@ frameworks.forEach((framework) => { let surveyResult; await t - .click(Selector(".sv_q_checkbox_control_label").withText("BMW")) - .click(Selector(".sv_q_checkbox_control_label").withText("Nissan")) + .click(controlLabelSelector.withText("BMW")) + .click(controlLabelSelector.withText("Nissan")) .click("input[value=Complete]"); surveyResult = await getSurveyResult(); @@ -81,16 +83,15 @@ frameworks.forEach((framework) => { test("change column count", async (t) => { const getClassName = ClientFunction( - () => document.querySelector("div[id*=sq_1] fieldset .sv_q_select_column").className + () => document.querySelector("div[id*=sq_1] fieldset > div > div").className ); - let className = await getClassName(); assert.notEqual(className.indexOf("sv-q-column-4"), -1); await setOptions("car", { colCount: 1 }); const getClassNameOneCol = ClientFunction( - () => document.querySelector("div[id*=sq_1] fieldset > .sv_q_checkbox").className + () => document.querySelector("div[id*=sq_1] fieldset > div").className ); className = await getClassNameOneCol(); assert.notEqual(className.indexOf("sv-q-col-1"), -1); @@ -103,16 +104,18 @@ frameworks.forEach((framework) => { test("change choices order", async (t) => { const getChoicesCount = ClientFunction( - () => - document.querySelectorAll( - "div[id*=sq_1] fieldset .sv_q_checkbox_control_item" - ).length + () => { + const checkboxControlClassName = ".sd-checkbox__control"; + return document.querySelectorAll( + `div[id*=sq_1] fieldset ${checkboxControlClassName}` + ).length; + } ); const getFirst = Selector( - "div[id*=sq_1] .sv_q_select_column:nth-child(1) .sv-string-viewer" + `div[id*=sq_1] ${columnClassName}:nth-child(1) .sv-string-viewer` ).nth(0); const getSecond = Selector( - "div[id*=sq_1] .sv_q_select_column:nth-child(2) .sv-string-viewer" + `div[id*=sq_1] ${columnClassName}:nth-child(2) .sv-string-viewer` ).nth(0); let rnd_count = 0; @@ -160,10 +163,13 @@ frameworks.forEach((framework) => { test("check integrity", async (t) => { let i; const getChoicesCount = ClientFunction( - () => - document.querySelectorAll( - "div[id*=sq_1] fieldset .sv_q_checkbox_control_item" - ).length + () => { + const columnClassName = ".sd-selectbase__column"; + const checkboxControlClassName = ".sd-checkbox__control"; + return document.querySelectorAll( + `div[id*=sq_1] fieldset ${checkboxControlClassName}` + ).length; + } ); const getChoicesExistence = ClientFunction(() => { var choices = [ @@ -212,10 +218,12 @@ frameworks.forEach((framework) => { test("check \"other\" choice doesn't change order", async (t) => { const getOtherChoice = Selector( - () => - document.querySelectorAll( - "div[id*=sq_1] fieldset .sv_q_select_column:nth-child(1) div:nth-of-type(4)" - )[0] + () => { + const columnClassName = ".sd-selectbase__column"; + return document.querySelectorAll( + `div[id*=sq_1] fieldset ${columnClassName}:nth-child(1) div:nth-of-type(4)` + )[0]; + } ); let otherChoice; @@ -307,24 +315,24 @@ frameworks.forEach((framework) => { test("checked class", async (t) => { const isCheckedClassExistsByIndex = ClientFunction((index) => - document + { + const columnClassName = ".sd-selectbase__column"; + return document .querySelector( - `fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(${index})` + `fieldset ${columnClassName}:nth-child(3) div:nth-of-type(${index})` ) - .classList.contains("checked") - ); + .classList.contains("sd-checkbox--checked"); + }); assert.equal(await isCheckedClassExistsByIndex(2), false); assert.equal(await isCheckedClassExistsByIndex(3), false); - await t .click( - "fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(2) label input" + `fieldset ${columnClassName}:nth-child(3) div:nth-of-type(2) label input` ) .click( - "fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(3) label input" + `fieldset ${columnClassName}:nth-child(3) div:nth-of-type(3) label input` ); - assert.equal(await isCheckedClassExistsByIndex(2), true); assert.equal(await isCheckedClassExistsByIndex(3), true); }); @@ -334,8 +342,9 @@ frameworks.forEach((framework) => { window["survey"].getAllQuestions()[0].hasSelectAll = true; }); const isSelectAllChecked = ClientFunction(() => { + const columnClassName = ".sd-selectbase__column"; return document.querySelector( - "fieldset .sv_q_select_column:nth-of-type(1) div:nth-of-type(1) input" + `fieldset ${columnClassName}:nth-of-type(1) div:nth-of-type(1) input` ).checked; }); const surveyData = { @@ -419,7 +428,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue.length, 0); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -438,7 +447,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue.length, 0); - var outerSelector = ".sv_q_checkbox_control_label"; + var outerSelector = ".sd-item__control-label"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -456,11 +465,9 @@ frameworks.forEach((framework) => { }); }); frameworks.forEach((framework) => { - const themeName = "defaultV2"; fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}` + .page`${url}${framework}` .beforeEach(async (t) => { - await applyTheme(themeName); await initSurvey(framework, json); }); test("maxSelectedChoices", async (t) => { diff --git a/testCafe/questions/comment.ts b/functionalTests/questions/comment.ts similarity index 86% rename from testCafe/questions/comment.ts rename to functionalTests/questions/comment.ts index 577122c419..12dd95031c 100644 --- a/testCafe/questions/comment.ts +++ b/functionalTests/questions/comment.ts @@ -2,7 +2,7 @@ import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionVa import { ClientFunction, Selector } from "testcafe"; const title = "comment"; -const commentQuestion = Selector(".sv_q textarea"); +const commentQuestion = Selector(".sd-question textarea"); const json = { questions: [ { @@ -46,28 +46,28 @@ frameworks.forEach(framework => { await t .click(commentQuestion) .expect(commentQuestion.getStyleProperty("resize")).eql("none") - .expect(commentQuestion.clientHeight).eql(116) + .expect(commentQuestion.clientHeight).eql(120) .pressKey("a enter a enter a enter a enter") .expect(commentQuestion.clientHeight).eql(144) .pressKey("backspace") - .expect(commentQuestion.clientHeight).eql(116) + .expect(commentQuestion.clientHeight).eql(120) .pressKey("tab") .expect(commentQuestion.nth(1).getStyleProperty("resize")).eql("none") - .expect(commentQuestion.nth(1).clientHeight).eql(60) + .expect(commentQuestion.nth(1).clientHeight).eql(72) .pressKey("a enter a enter") - .expect(commentQuestion.nth(1).clientHeight).eql(88) + .expect(commentQuestion.nth(1).clientHeight).eql(96) .pressKey("backspace") - .expect(commentQuestion.nth(1).clientHeight).eql(60) + .expect(commentQuestion.nth(1).clientHeight).eql(72) .pressKey("tab") .expect(commentQuestion.nth(2).getStyleProperty("resize")).eql("none") - .expect(commentQuestion.nth(2).clientHeight).eql(116) + .expect(commentQuestion.nth(2).clientHeight).eql(120) .pressKey("a enter a enter a enter a enter") - .expect(commentQuestion.nth(2).clientHeight).eql(116) + .expect(commentQuestion.nth(2).clientHeight).eql(120) .expect(commentQuestion.nth(2).value).eql("aaaa") .typeText(commentQuestion.nth(2), "a\na\na\na\n", { replace: true }) @@ -87,12 +87,12 @@ frameworks.forEach(framework => { } ] }); - await t.expect(commentQuestion.clientHeight).eql(32); + await t.expect(commentQuestion.clientHeight).eql(48); await ClientFunction(() => window["survey"].data = { "question1": "

Thank you for your feedback.

We are glad that you share with us your ideas.We highly value all suggestions from our customers. We do our best to improve the product and reach your expectation.

" } )(); - await t.expect(commentQuestion.clientHeight).eql(60); + await t.expect(commentQuestion.clientHeight).eql(120); }); test("autoGrow with default value", async (t) => { @@ -116,7 +116,7 @@ frameworks.forEach(framework => { await t .expect(commentQuestion.value).eql("The comment area has an initial height of two rows and automatically expands or shrinks to accomodate the content.") - .expect(commentQuestion.clientHeight).eql(88); + .expect(commentQuestion.clientHeight).eql(96); }); test("fill textarea", async t => { @@ -140,7 +140,7 @@ frameworks.forEach(framework => { test("click on question title state editable", async (t) => { const newTitle = "MyText"; - const outerSelector = ".sv_q_title"; + const outerSelector = ".sd-question__title"; const innerSelector = ".sv-string-editor"; await initSurvey(framework, json, undefined, true); @@ -156,7 +156,7 @@ frameworks.forEach(framework => { }); test("Remaining character counter", async (t) => { - const characterCounter = Selector(".sv-remaining-character-counter"); + const characterCounter = Selector(".sd-remaining-character-counter"); await initSurvey(framework, { focusFirstQuestionAutomatic: true, diff --git a/testCafe/questions/component_single_question.ts b/functionalTests/questions/component_single_question.ts similarity index 96% rename from testCafe/questions/component_single_question.ts rename to functionalTests/questions/component_single_question.ts index 4318dc1def..b520d89143 100644 --- a/testCafe/questions/component_single_question.ts +++ b/functionalTests/questions/component_single_question.ts @@ -1,7 +1,7 @@ import { frameworks, url, initSurvey, getListItemByText, completeButton, getSurveyResult } from "../helper"; import { Selector, ClientFunction } from "testcafe"; const title = "component_single_question"; -const questionDropdownSelect = Selector(".sv_q_dropdown_control"); +const questionDropdownSelect = Selector(".sd-dropdown"); const json_question = { elements: [ { diff --git a/testCafe/questions/dropdown.js b/functionalTests/questions/dropdown.js similarity index 94% rename from testCafe/questions/dropdown.js rename to functionalTests/questions/dropdown.js index cfb4d1e732..b0d6848cf6 100644 --- a/testCafe/questions/dropdown.js +++ b/functionalTests/questions/dropdown.js @@ -1,15 +1,15 @@ -import { frameworks, url, url_test, applyTheme, setOptions, getListItemByText, completeButton, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, registerCustomItemComponent } from "../helper"; +import { frameworks, url, setOptions, getListItemByText, completeButton, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, registerCustomItemComponent } from "../helper"; import { Selector, fixture, test, ClientFunction } from "testcafe"; const title = "dropdown"; -const questionDropdownSelect = Selector(".sv_q_dropdown_control"); +const questionDropdownSelect = Selector(".sd-dropdown"); const listItems = Selector(".sv-list__item span"); -const questionValue = Selector(".sv_q_dropdown__value"); -const questionValueInput = Selector(".sv_q_dropdown__value input"); -const questionValueText = Selector(".sv_q_dropdown__value .sv-string-viewer"); -const questionValueHint = Selector(".sv_q_dropdown__hint-suffix"); +const questionValue = Selector(".sd-dropdown__value"); +const questionValueInput = Selector(".sd-dropdown__value input"); +const questionValueText = Selector(".sd-dropdown__value .sv-string-viewer"); +const questionValueHint = Selector(".sd-dropdown__hint-suffix"); -const clearButton = Selector(".sv_q_dropdown_clean-button"); +const clearButton = Selector(".sd-dropdown_clean-button"); const questionOffsetTopConst = 176; @@ -306,7 +306,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - const outerSelector = ".sv_q_title"; + const outerSelector = ".sd-question__title"; const innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -370,7 +370,6 @@ frameworks.forEach((framework) => { }; const oldOtherText = "Other (describe)"; const newOtherText = "New Other"; - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); await initSurvey(framework, currentJson); await t.expect(Selector("select option").nth(10).textContent).eql(oldOtherText); @@ -449,14 +448,14 @@ frameworks.forEach((framework) => { .click(questionDropdownSelect) .expect(popupContainer.visible).ok() - .expect(popupContainer.offsetWidth).gte(900) + .expect(popupContainer.offsetWidth).gte(550) .click(Selector(".sv-list__item span").withText("Ford").filterVisible()) .expect(popupContainer.visible).notOk() .click(questionValueText) .expect(popupContainer.visible).ok() - .expect(popupContainer.offsetWidth).gte(900); + .expect(popupContainer.offsetWidth).gte(550); }); test("Check dropdown disabled items", async (t) => { @@ -543,10 +542,10 @@ frameworks.forEach((framework) => { .expect(Selector("option[value=Vauxhall]").hasAttribute("disabled")).ok() .click("select"); - const questionDropdownSelect = Selector(".sv_q_dropdown_control").nth(1); + const questionDropdownSelect2 = questionDropdownSelect.nth(1); const popupContainer = Selector(".sv-popup__container").filterVisible(); await t - .click(questionDropdownSelect) + .click(questionDropdownSelect2) .expect(Selector(".sv-list__item").count).eql(28) .expect(Selector(".sv-list__item.sv-list__item--disabled").count).eql(13) .click(Selector(".sv-list__item span").withText("item2").filterVisible()) @@ -631,7 +630,7 @@ frameworks.forEach((framework) => { .click(myListItems.nth(3)) - .expect(Selector(".sv_q_dropdown__value").find(".sv-svg-icon").count).eql(1); + .expect(questionValue.find(".sv-svg-icon").count).eql(1); }); test("Check dropdown key press with searchEnabled", async (t) => { @@ -703,6 +702,7 @@ frameworks.forEach((framework) => { .pressKey("enter") .expect(questionValueInput.value).eql("Nissan") + .wait(100) .pressKey("down") .expect(popupContainer.visible).ok() .pressKey("up") @@ -717,6 +717,7 @@ frameworks.forEach((framework) => { .pressKey("enter") .expect(questionValueInput.nth(1).value).eql("item20") + .wait(100) .pressKey("down") .pressKey("down") .pressKey("enter") @@ -842,6 +843,7 @@ frameworks.forEach((framework) => { .pressKey("enter") .expect(questionValueText.textContent).eql("Nissan") + .wait(100) .pressKey("space") .expect(popupContainer.visible).ok() .pressKey("up") @@ -1170,7 +1172,7 @@ frameworks.forEach((framework) => { } ] }; - const oldDropdown = Selector(".sv_q_dropdown_control").nth(1); + const oldDropdown = questionDropdownSelect.nth(1); await initSurvey(framework, jsonWithDropDown); await t @@ -1277,7 +1279,6 @@ frameworks.forEach((framework) => { await initSurvey(framework, jsonWithDropDown); const popupContainer = Selector(".sv-popup__container"); const focusedItem = Selector(".sv-list__item--focused span"); - await t .resizeWindow(1280, 600) @@ -1287,7 +1288,6 @@ frameworks.forEach((framework) => { .expect(popupContainer.nth(0).visible).ok() .expect(popupContainer.nth(0).find(".sv-list__item").count).eql(27) .expect(popupContainer.nth(0).find(".sv-list").scrollTop).eql(0) - .pressKey("up") .expect(focusedItem.textContent).eql("item27") .expect(popupContainer.nth(0).find(".sv-list").scrollTop).gt(400) @@ -1307,9 +1307,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - const theme = "defaultV2"; - test.page(`${url_test}${theme}/${framework}`)("Check rating as dropdown", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check rating as dropdown", async (t) => { const jsonWithDropDown = { questions: [ @@ -1337,8 +1335,7 @@ frameworks.forEach((framework) => { .pressKey("delete") .expect(ratingAsDropdownPlaceholder.getAttribute("placeholder")).eql(ratingAsDropdownPlaceHolder); }); - test.page(`${url_test}${theme}/${framework}`)("Check dropdown popup width - long", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check dropdown popup width - long", async (t) => { const json = { "elements": [ { @@ -1394,8 +1391,7 @@ frameworks.forEach((framework) => { }, 500); } - test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height with lazy loading", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -1488,8 +1484,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height and position while searching", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -1691,8 +1686,8 @@ frameworks.forEach((framework) => { }; await initSurvey(framework, jsonWithDropDown); const popupContainer = Selector(".sv-popup__container").filterVisible(); - const input = Selector(".sv_q_dropdown_control input").filterVisible(); - const str = Selector(".sv_q_dropdown_control .sv-string-viewer"); + const input =questionDropdownSelect.find("input").filterVisible(); + const str = questionValue.find(".sv-string-viewer"); await t .expect(popupContainer.visible).notOk() @@ -1809,24 +1804,24 @@ frameworks.forEach((framework) => { .expect(popupContainer.visible).notOk() .click(questionDropdownSelect.nth(1)) .expect(popupContainer.visible).ok() - .expect(popupContainer.offsetTop).within(85, 95) - .expect(popupContainer.offsetLeft).within(460, 470) - .expect(popupContainer.offsetHeight).within(490, 500) - .expect(popupContainer.offsetWidth).within(395, 400) + .expect(popupContainer.offsetTop).within(160, 170) + .expect(popupContainer.offsetLeft).within(490, 500) + .expect(popupContainer.offsetHeight).within(410, 420) + .expect(popupContainer.offsetWidth).within(310, 320) .resizeWindow(1280, 1100) .expect(popupContainer.visible).ok() - .expect(popupContainer.offsetTop).within(85, 95) - .expect(popupContainer.offsetLeft).within(650, 660) - .expect(popupContainer.offsetHeight).within(985, 990) - .expect(popupContainer.offsetWidth).within(585, 595) + .expect(popupContainer.offsetTop).within(160, 170) + .expect(popupContainer.offsetLeft).within(680, 690) + .expect(popupContainer.offsetHeight).within(910, 920) + .expect(popupContainer.offsetWidth).within(500, 510) .resizeWindow(900, 600) .expect(popupContainer.visible).ok() - .expect(popupContainer.offsetTop).within(85, 95) - .expect(popupContainer.offsetLeft).within(460, 470) - .expect(popupContainer.offsetHeight).within(490, 540) - .expect(popupContainer.offsetWidth).within(395, 440); + .expect(popupContainer.offsetTop).within(160, 170) + .expect(popupContainer.offsetLeft).within(490, 500) + .expect(popupContainer.offsetHeight).within(410, 460) + .expect(popupContainer.offsetWidth).within(310, 320); }); test("check dropdown after navigating between pages", async t => { @@ -1881,8 +1876,8 @@ frameworks.forEach((framework) => { .click(getListItemByText("3")) .expect(popupContainer.exists).notOk() - .click(".sv_next_btn") - .click(".sv_prev_btn") + .click(".sd-navigation__next-btn") + .click(".sd-navigation__prev-btn") .expect(popupContainer.exists).notOk() .click(questionDropdownSelect) @@ -1891,13 +1886,12 @@ frameworks.forEach((framework) => { .expect(questionValueText.textContent).eql("3") .expect(questionValueInput.getAttribute("placeholder")).eql("") - .click(".sv_q_dropdown_clean-button") + .click(clearButton) .expect(questionValueText.exists).notEql() .expect(questionValueInput.getAttribute("placeholder")).eql("Select..."); }); - test.page(`${url_test}${theme}/${framework}`)("choicesFromQuestion, bug#5818", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("choicesFromQuestion, bug#5818", async (t) => { const json = { "elements": [ @@ -1942,7 +1936,7 @@ frameworks.forEach((framework) => { .click(getListItemByText("Audi")); }); - test.page(`${url_test}${theme}/${framework}`)("Check dropdown popup opens after beak click", async (t) => { + test.page(`${url}${framework}`)("Check dropdown popup opens after beak click", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { questions: [ @@ -1988,7 +1982,7 @@ frameworks.forEach((framework) => { .expect(popupContainer.visible).notOk(); }); - test.page(`${url_test}${theme}/${framework}`)("Check dropdown popup tab navigation", async (t) => { + test.page(`${url}${framework}`)("Check dropdown popup tab navigation", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { questions: [ @@ -2027,7 +2021,7 @@ frameworks.forEach((framework) => { .expect(questionTextSelect.filterVisible().focused).ok(); }); - test.page(`${url_test}${theme}/${framework}`)("Check dropdown popup opens after beak click - search enabled", async (t) => { + test.page(`${url}${framework}`)("Check dropdown popup opens after beak click - search enabled", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { questions: [ @@ -2072,7 +2066,7 @@ frameworks.forEach((framework) => { .expect(popupContainer.visible).notOk(); }); - test.page(`${url_test}${theme}/${framework}`)("Dropdown shold not be open when disabled", async (t) => { + test.page(`${url}${framework}`)("Dropdown shold not be open when disabled", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { pages: [ @@ -2108,7 +2102,7 @@ frameworks.forEach((framework) => { .expect(popupContainer.visible).notOk(); }); - test.page(`${url_test}${theme}/${framework}`)("focusOnFirstError bricks dropdown popup if any errors are on the same page", async (t) => { + test.page(`${url}${framework}`)("focusOnFirstError bricks dropdown popup if any errors are on the same page", async (t) => { await t.resizeWindow(800, 600); const json = { pages: [ @@ -2298,21 +2292,21 @@ frameworks.forEach((framework) => { window.survey.locale = locale; }); await t - .expect(Selector(".sv_q_dropdown__value span").withExactText("notenglish").exists).ok() + .expect(questionValue.find("span").withExactText("notenglish").exists).ok() .click("input") .expect(Selector("li div").withAttribute("title", "notenglish").exists).ok() .expect(Selector("li div span").withExactText("notenglish").exists).ok() .click("body", { offsetX: 0 }); await changeLocale("en"); await t - .expect(Selector(".sv_q_dropdown__value span").withExactText("english").exists).ok() + .expect(questionValue.find("span").withExactText("english").exists).ok() .click("input") .expect(Selector("li div").withAttribute("title", "english").exists).ok() .expect(Selector("li div span").withExactText("english").exists).ok() .click("body", { offsetX: 0 }); await changeLocale("de"); await t - .expect(Selector(".sv_q_dropdown__value span").withExactText("notenglish").exists).ok() + .expect(questionValue.find("span").withExactText("notenglish").exists).ok() .click("input") .expect(Selector("li div").withAttribute("title", "notenglish").exists).ok() .expect(Selector("li div span").withExactText("notenglish").exists).ok() diff --git a/testCafe/questions/dropdownRestfull.js b/functionalTests/questions/dropdownRestfull.js similarity index 92% rename from testCafe/questions/dropdownRestfull.js rename to functionalTests/questions/dropdownRestfull.js index 06fcd09063..2c77d66b59 100644 --- a/testCafe/questions/dropdownRestfull.js +++ b/functionalTests/questions/dropdownRestfull.js @@ -54,13 +54,13 @@ frameworks.forEach(framework => { test("change \"value\" in the returned json", async t => { await t .wait(1000) - .expect(Selector(".sv_row select option[value=\"Cuba\"]").exists).ok() - .expect(Selector(".sv_row select option[value=\"CU\"]").exists).notOk(); + .expect(Selector(".sd-row select option[value=\"Cuba\"]").exists).ok() + .expect(Selector(".sd-row select option[value=\"CU\"]").exists).notOk(); await changeValue(); await t - .expect(Selector(".sv_row select option[value=\"Cuba\"]").exists).notOk() - .expect(Selector(".sv_row select option[value=\"CU\"]").exists).ok() + .expect(Selector(".sd-row select option[value=\"Cuba\"]").exists).notOk() + .expect(Selector(".sd-row select option[value=\"CU\"]").exists).ok() .click("select") .click(Selector("option").withText("Cuba")) .click("input[value=Complete]"); @@ -92,7 +92,7 @@ frameworks.forEach(framework => { } ); - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); + const questionDropdownSelect = Selector(".sd-dropdown"); test("choose empty", async t => { await checkSurveyWithEmptyQuestion(t); @@ -157,7 +157,7 @@ frameworks.forEach(framework => { } ); test("Carry forward for choicesByUrl", async t => { - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); + const questionDropdownSelect = Selector(".sd-dropdown"); const popupContainer = Selector(".sv-popup__container").filterVisible(); await setData({ q1: ["United States", "Romania"], q2: "Romania" }); diff --git a/testCafe/questions/file.js b/functionalTests/questions/file.js similarity index 96% rename from testCafe/questions/file.js rename to functionalTests/questions/file.js index 80635b208b..de41083d0b 100644 --- a/testCafe/questions/file.js +++ b/functionalTests/questions/file.js @@ -1,4 +1,4 @@ -import { frameworks, url, setOptions, initSurvey, getSurveyResult, url_test, getQuestionValue, getQuestionJson, getData } from "../helper"; +import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, getData } from "../helper"; import { ClientFunction, fixture, Selector, test } from "testcafe"; const title = "file"; @@ -91,7 +91,7 @@ frameworks.forEach(framework => { await t.click("input[type=file] + div label"); const cleanButtonSelector = Selector("button").withText("Clear"); await t.click(cleanButtonSelector); - await t.expect(cleanButtonSelector.exists).notOk(); + await t.expect(cleanButtonSelector.visible).notOk(); }); test("choose image", async t => { @@ -160,13 +160,13 @@ frameworks.forEach(framework => { await t .click("input[type=file] + div label") - .click(".sv_q_file_remove_button") + .click(".sd-context-btn--negative") .click(".sv-popup--confirm .sd-btn"); let data = await getData(); await t.expect(data["image"][0].name).eql("small_Dashka.jpg") - - .click(".sv_q_file_remove_button") + .wait(100) + .click(".sd-context-btn--negative") .click(".sv-popup--confirm .sd-btn--danger"); data = await getData(); @@ -222,7 +222,7 @@ frameworks.forEach(framework => { }); frameworks.forEach(framework => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { await initSurvey(framework, { elements: [ diff --git a/testCafe/questions/file.ts b/functionalTests/questions/file.ts similarity index 82% rename from testCafe/questions/file.ts rename to functionalTests/questions/file.ts index 70a1688521..8adfe18c42 100644 --- a/testCafe/questions/file.ts +++ b/functionalTests/questions/file.ts @@ -1,9 +1,9 @@ -import { frameworks, initSurvey, url_test } from "../helper"; +import { frameworks, initSurvey, url } from "../helper"; import { ClientFunction, Selector } from "testcafe"; const title = "file"; frameworks.forEach(framework => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { await initSurvey(framework, { elements: [ diff --git a/testCafe/questions/html.js b/functionalTests/questions/html.js similarity index 100% rename from testCafe/questions/html.js rename to functionalTests/questions/html.js diff --git a/testCafe/questions/image.js b/functionalTests/questions/image.js similarity index 92% rename from testCafe/questions/image.js rename to functionalTests/questions/image.js index 1d3e8013f3..76eba37624 100644 --- a/testCafe/questions/image.js +++ b/functionalTests/questions/image.js @@ -30,10 +30,10 @@ frameworks.forEach(framework => { ); function SelectorByNumber(questionNumber) { - return Selector(".sv_body .sv_row") + return Selector(".sd-body .sd-row") .nth(questionNumber) - .find(".sv_qstn") - .find(".sv_q_image"); + .find(".sd-question") + .find(".sd-image"); } test("Check image question layout", async t => { @@ -41,6 +41,5 @@ frameworks.forEach(framework => { .expect(SelectorByNumber(0).child("img").exists).ok() .expect(SelectorByNumber(1).child("video").exists).ok() .expect(SelectorByNumber(2).child("iframe").exists).ok(); - }); }); \ No newline at end of file diff --git a/testCafe/questions/imagepicker.js b/functionalTests/questions/imagepicker.js similarity index 81% rename from testCafe/questions/imagepicker.js rename to functionalTests/questions/imagepicker.js index fc5b20214b..03a20155a9 100644 --- a/testCafe/questions/imagepicker.js +++ b/functionalTests/questions/imagepicker.js @@ -1,5 +1,5 @@ import { ClientFunction, fixture, Selector, test } from "testcafe"; -import { frameworks, url, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, urlV2, applyTheme } from "../helper"; +import { frameworks, url, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, urlV2 } from "../helper"; // eslint-disable-next-line no-undef const assert = require("assert"); const title = "imagepicker"; @@ -46,10 +46,10 @@ frameworks.forEach(framework => { test("check integrity", async t => { await t - .hover("fieldset.sv_imgsel .sv_q_imgsel:nth-of-type(1)") - .hover("fieldset.sv_imgsel .sv_q_imgsel:nth-of-type(2)") - .hover("fieldset.sv_imgsel .sv_q_imgsel:nth-of-type(3)") - .hover("fieldset.sv_imgsel .sv_q_imgsel:nth-of-type(4)"); + .hover("fieldset.sd-imagepicker .sd-imagepicker__item:nth-of-type(1)") + .hover("fieldset.sd-imagepicker .sd-imagepicker__item:nth-of-type(2)") + .hover("fieldset.sd-imagepicker .sd-imagepicker__item:nth-of-type(3)") + .hover("fieldset.sd-imagepicker .sd-imagepicker__item:nth-of-type(4)"); }); test("choose empty", async t => { @@ -60,21 +60,21 @@ frameworks.forEach(framework => { let surveyResult; await t - .click("fieldset.sv_imgsel .sv_q_imgsel:nth-of-type(2)") + .click("fieldset.sd-imagepicker .sd-imagepicker__item:nth-of-type(2)") .click("input[value=Complete]"); surveyResult = await getSurveyResult(); assert.equal(surveyResult.choosepicture, "giraffe"); }); test("imagelink reactiveness", async t => { - await t.expect(Selector(".sv_q_imgsel").nth(0).find("img").exists).ok(); - await t.expect(Selector(".sv_q_imgsel__no-image").exists).notOk(); + await t.expect(Selector(".sd-imagepicker__item").nth(0).find("img").exists).ok(); + await t.expect(Selector(".sd-imagepicker__no-image").exists).notOk(); await ClientFunction(()=>{ window.survey.getAllQuestions()[0].choices[0].imageLink = "custom_link"; })(); - await t.expect(Selector(".sv_q_imgsel").nth(0).find("img").exists).notOk(); - await t.expect(Selector(".sv_q_imgsel__no-image").exists).ok(); + await t.expect(Selector(".sd-imagepicker__item").nth(0).find("img").exists).notOk(); + await t.expect(Selector(".sd-imagepicker__no-image").exists).ok(); }); }); @@ -91,7 +91,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -131,7 +131,6 @@ frameworks.forEach((framework) => { } ] }; - await applyTheme("defaultV2"); await initSurvey(framework, json); } ); diff --git a/testCafe/questions/input_mask.ts b/functionalTests/questions/input_mask.ts similarity index 97% rename from testCafe/questions/input_mask.ts rename to functionalTests/questions/input_mask.ts index 6c3337bca8..8bcba1c926 100644 --- a/testCafe/questions/input_mask.ts +++ b/functionalTests/questions/input_mask.ts @@ -60,10 +60,10 @@ frameworks.forEach((framework) => { await t .expect(getCursor()).eql(0) - .click(Selector(".sv_q_text_root").nth(0)) + .click(Selector(".sd-text").nth(0)) .expect(getCursor()).eql(0); await t - .click(Selector(".sv_q_text_root").nth(1)) + .click(Selector(".sd-text").nth(1)) .expect(getCursor()).eql(6); }); diff --git a/testCafe/questions/matrix.js b/functionalTests/questions/matrix.js similarity index 97% rename from testCafe/questions/matrix.js rename to functionalTests/questions/matrix.js index e9d1e4196a..039193708f 100644 --- a/testCafe/questions/matrix.js +++ b/functionalTests/questions/matrix.js @@ -92,7 +92,7 @@ frameworks.forEach((framework) => { const isCheckedClassExistsByIndex = ClientFunction((index) => document .querySelector(`fieldset tbody tr td:nth-child(${index + 1}) label`) - .classList.contains("checked") + .classList.contains("sd-radio--checked") ); assert.equal(await isCheckedClassExistsByIndex(2), false); @@ -142,7 +142,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -161,7 +161,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var outerSelector = ".sv_q_matrix th"; + var outerSelector = ".sd-matrix__table th"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -180,7 +180,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var selector = ".sv_q_matrix tbody tr td .sv-string-editor"; + var selector = ".sd-matrix__table tbody tr td .sv-string-editor"; await t .click(selector) .typeText(selector, newTitle, { replace: true }) diff --git a/testCafe/questions/matrixdropdown.js b/functionalTests/questions/matrixdropdown.js similarity index 84% rename from testCafe/questions/matrixdropdown.js rename to functionalTests/questions/matrixdropdown.js index 7abab1ac85..287e4ad30f 100644 --- a/testCafe/questions/matrixdropdown.js +++ b/functionalTests/questions/matrixdropdown.js @@ -55,35 +55,39 @@ const json = { frameworks.forEach(framework => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json); } ); test("choose several values", async t => { - const questionDropdownClassName = ".sv_q_dropdown_control"; - const Angular1Row = Selector(".sv_matrix_row").nth(0); - const KnockoutRow = Selector(".sv_matrix_row").nth(2); - + const matrixRowSelector = Selector(".sd-table__row"); + const Angular1Row = matrixRowSelector.nth(0); + const KnockoutRow = matrixRowSelector.nth(2); + const radioControlClassName = ".sd-radio__control"; + const questionDropdownClassName = ".sd-dropdown"; + const checkboxControlClassName = ".sd-checkbox__control"; + const textControlClassName = ".sd-text"; // answer for row 1 await t - .click(Angular1Row.find(".sv_q_radiogroup_control_item[value=Yes]")) + .click(Angular1Row.find(radioControlClassName).withAttribute("value", "Yes")) .click(Angular1Row.find(questionDropdownClassName).nth(0)) .click(getListItemByText("2")) .click(Selector("body"), { offsetX: 1, offsetY: 1 }) - .click(Angular1Row.find(".sv_q_checkbox_control_item[value=Fast]")) - .typeText(Angular1Row.find(".sv_q_text_root"), "why hello world so hard") + .click(Angular1Row.find(checkboxControlClassName).withAttribute("value", "Fast")) + .typeText(Angular1Row.find(textControlClassName), "why hello world so hard") .click(Angular1Row.find(questionDropdownClassName).nth(1)) .click(getListItemByText("Excelent")) .click(Selector("body"), { offsetX: 1, offsetY: 1 }); // answer for row 3 await t - .click(KnockoutRow.find(".sv_q_radiogroup_control_item[value=No]")) + .click(KnockoutRow.find(radioControlClassName).withAttribute("value", "No")) .click(KnockoutRow.find(questionDropdownClassName).nth(0)) .click(getListItemByText("5")) .click(Selector("body"), { offsetX: 1, offsetY: 1 }) - .click(KnockoutRow.find(".sv_q_checkbox_control_item[value=Easy]")) - .click(KnockoutRow.find(".sv_q_checkbox_control_item[value=Powerfull]")) - .typeText(KnockoutRow.find(".sv_q_text_root"), "it is not 2016") + .click(KnockoutRow.find(checkboxControlClassName).withAttribute("value", "Easy")) + .click(KnockoutRow.find(checkboxControlClassName).withAttribute("value", "Powerfull")) + .typeText(KnockoutRow.find(textControlClassName), "it is not 2016") .click(KnockoutRow.find(questionDropdownClassName).nth(1)) .click(getListItemByText("Good")); diff --git a/testCafe/questions/matrixdropdownMultiplecolumns.js b/functionalTests/questions/matrixdropdownMultiplecolumns.js similarity index 100% rename from testCafe/questions/matrixdropdownMultiplecolumns.js rename to functionalTests/questions/matrixdropdownMultiplecolumns.js diff --git a/testCafe/questions/matrixdynamic.js b/functionalTests/questions/matrixdynamic.js similarity index 89% rename from testCafe/questions/matrixdynamic.js rename to functionalTests/questions/matrixdynamic.js index 43351e5989..43ffd7e1ae 100644 --- a/testCafe/questions/matrixdynamic.js +++ b/functionalTests/questions/matrixdynamic.js @@ -2,6 +2,8 @@ import { frameworks, url, initSurvey, getSurveyResult, getListItemByText, comple import { ClientFunction, Selector, fixture, test } from "testcafe"; const title = "matrixdynamic"; +const matrixRowSelector = Selector(".sd-table__row"); +const matrixButton = Selector(".sd-matrixdynamic__btn"); const json = { questions: [ { @@ -101,19 +103,19 @@ const json = { frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json); } ); - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); + const questionDropdownSelect = Selector(".sd-dropdown"); test("choose empty", async (t) => { - const matrixRow = Selector(".sv_matrix_row"); const getRequiredElement = (rowIndex) => { - return matrixRow.nth(rowIndex).find(".sv-string-viewer").withText("Response required."); + return matrixRowSelector.nth(rowIndex).find(".sv-string-viewer").withText("Response required."); }; const getRowsCount = () => { - return matrixRow.count; + return matrixRowSelector.count; }; await t @@ -144,13 +146,13 @@ frameworks.forEach((framework) => { for (let i = 0; i < 11; i++) { // answer radios - await t.click(Selector(".sv_matrix_row").nth(rowNumber).find(".sv_matrix_cell .sv_q_radiogroup_control_item[value='1']").nth(i)); + await t.click(matrixRowSelector.nth(rowNumber).find(".sd-table__cell .sd-radio__control[value='1']").nth(i)); } await t // answer comments - .typeText(Selector(".sv_matrix_row").nth(rowNumber).find("textarea").nth(0), "Wombats") - .typeText(Selector(".sv_matrix_row").nth(rowNumber).find("textarea").nth(1), "Wombats") - .typeText(Selector(".sv_matrix_row").nth(rowNumber).find("textarea").nth(2), "Wombats"); + .typeText(matrixRowSelector.nth(rowNumber).find("textarea").nth(0), "Wombats") + .typeText(matrixRowSelector.nth(rowNumber).find("textarea").nth(1), "Wombats") + .typeText(matrixRowSelector.nth(rowNumber).find("textarea").nth(2), "Wombats"); }; await fillTheRow(0); @@ -201,16 +203,17 @@ frameworks.forEach((framework) => { test("remove row", async (t) => { await t - .expect(Selector(".sv_matrix_row").count).eql(2) - + .expect(matrixRowSelector.count).eql(2) .click(questionDropdownSelect.nth(0)) + .wait(500) .click(getListItemByText("Science: Physical Science")) .click(questionDropdownSelect.nth(1)) + .wait(500) .click(getListItemByText("Science: Chemistry")) - - .click(Selector(".sv_matrix_dynamic_button .sv-string-viewer").nth(1).withText("Remove")) - .expect(Selector(".sv_matrix_row").count).eql(1); + .click(matrixButton.nth(1).withAttribute("title", "Remove")) + .wait(500) + .expect(matrixRowSelector.count).eql(1); await t.click(completeButton); @@ -221,9 +224,9 @@ frameworks.forEach((framework) => { test("add row", async (t) => { await t.resizeWindow(1920, 1080); await t - .expect(Selector(".sv_matrix_row").count).eql(2) + .expect(matrixRowSelector.count).eql(2) .click(Selector("button[type=button]").withText("Add Subject")) - .expect(Selector(".sv_matrix_row").count).eql(3) + .expect(matrixRowSelector.count).eql(3) .click(questionDropdownSelect.nth(0)) .click(getListItemByText("Science: Physical Science")) @@ -275,20 +278,19 @@ frameworks.forEach((framework) => { } ); test("bindings rowCount", async (t) => { - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); - const clearButton = Selector(".sv_q_dropdown_clean-button"); - + const questionDropdownSelect = Selector(".sd-dropdown"); + const clearButton = Selector(".sd-dropdown_clean-button"); await t.resizeWindow(1920, 1080); await t - .expect(Selector(".sv_matrix_row").count).eql(0) + .expect(matrixRowSelector.count).eql(0) .click(questionDropdownSelect) .click(Selector(".sv-list__item span").withText("3").filterVisible()) - .expect(Selector(".sv_matrix_row").count).eql(3) + .expect(matrixRowSelector.count).eql(3) .click(clearButton) - .expect(Selector(".sv_matrix_row").count).eql(0) + .expect(matrixRowSelector.count).eql(0) .click(questionDropdownSelect) .click(Selector(".sv-list__item span").withText("5").filterVisible()) - .expect(Selector(".sv_matrix_row").count).eql(5); + .expect(matrixRowSelector.count).eql(5); }); }); const json3 = { @@ -315,7 +317,7 @@ frameworks.forEach((framework) => { } ); test("bindings rowCount", async (t) => { - const removeButton = Selector(".sv_matrix_dynamic_button .sv-string-viewer").nth(1).withText("Remove"); + const removeButton = matrixButton.nth(1).withAttribute("title", "Remove"); await t.resizeWindow(1920, 1080); await t .click(removeButton) @@ -394,13 +396,14 @@ frameworks.forEach((framework) => { ); test("remove row vs confirmDelete and differerent locale", async (t) => { await t - .expect(Selector(".sv_matrix_row").count).eql(3) - .click(Selector(".sv_matrix_dynamic_button .sv-string-viewer").nth(1).withText("Entfernen")) + .expect(matrixRowSelector.count).eql(3) + .click(matrixButton.nth(1).withAttribute("title", "Entfernen")) .click(Selector("span").withExactText("Abbrechen")) - .expect(Selector(".sv_matrix_row").count).eql(3) - .click(Selector(".sv_matrix_dynamic_button .sv-string-viewer").nth(1).withText("Entfernen")) + .expect(matrixRowSelector.count).eql(3) + .wait(100) + .click(matrixButton.nth(1).withAttribute("title", "Entfernen")) .click(Selector("span").withExactText("OK")) - .expect(Selector(".sv_matrix_row").count).eql(2); + .expect(matrixRowSelector.count).eql(2); }); }); @@ -448,6 +451,7 @@ frameworks.forEach((framework) => { test("visibleIf columns mobile", async (t) => { const textSelector = Selector("input").withAttribute("type", "text").filterVisible(); await ClientFunction(() => window.survey.setIsMobile(true))(); + await t.resizeWindow(600, 1080); await t .expect(Selector("tbody tr").nth(0).find("td").count).eql(2) .expect(Selector("tbody tr").nth(1).find("td").count).eql(2) diff --git a/testCafe/questions/matrixdynamic_totals.js b/functionalTests/questions/matrixdynamic_totals.js similarity index 100% rename from testCafe/questions/matrixdynamic_totals.js rename to functionalTests/questions/matrixdynamic_totals.js diff --git a/testCafe/questions/matrixrubric.js b/functionalTests/questions/matrixrubric.js similarity index 94% rename from testCafe/questions/matrixrubric.js rename to functionalTests/questions/matrixrubric.js index 6a8a064985..2b2920fd12 100644 --- a/testCafe/questions/matrixrubric.js +++ b/functionalTests/questions/matrixrubric.js @@ -81,9 +81,9 @@ frameworks.forEach((framework) => { const secondCellSelector = Selector("tbody tr:nth-child(4) td:nth-child(6)"); await t .click(firstCellSelector) - .expect(firstCellSelector.hasClass("sv_q_m_cell_selected")).ok() + .expect(firstCellSelector.hasClass("sd-matrix__text--checked")).ok() .click(secondCellSelector) - .expect(secondCellSelector.hasClass("sv_q_m_cell_selected")).ok() + .expect(secondCellSelector.hasClass("sd-matrix__text--checked")).ok() .click("input[value=Complete]"); surveyResult = await getSurveyResult(); await t.expect(surveyResult.Quality).eql({ @@ -148,7 +148,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -167,7 +167,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = ".sv_q_matrix th"; + var outerSelector = ".sd-matrix__table th"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -186,7 +186,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var selector = ".sv_q_matrix tbody tr td .sv-string-editor"; + var selector = ".sd-matrix__table tbody tr td .sv-string-editor"; await t .click(selector) .typeText(selector, newTitle, { replace: true }) @@ -204,7 +204,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var selector = ".sv_q_matrix tbody tr:nth-child(4) td:nth-child(6) .sv-string-editor"; + var selector = ".sd-matrix__table tbody tr:nth-child(4) td:nth-child(6) .sv-string-editor"; await t .click(selector) .typeText(selector, newTitle, { replace: true }) diff --git a/testCafe/questions/multipletext.js b/functionalTests/questions/multipletext.js similarity index 92% rename from testCafe/questions/multipletext.js rename to functionalTests/questions/multipletext.js index 8737d020ce..eb7a8991c9 100644 --- a/testCafe/questions/multipletext.js +++ b/functionalTests/questions/multipletext.js @@ -28,13 +28,13 @@ const json = { frameworks.forEach(framework => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json); } ); test("fill text fields", async t => { let surveyResult; - await t .typeText("tr > td:nth-child(1) input", "All my money") .typeText("tr > td:nth-child(2) input", "Zero") @@ -81,7 +81,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -100,7 +100,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var selector = ".sv_q_mt_title .sv-string-editor"; + var selector = ".sd-multipletext__item-title .sv-string-editor"; await t .click(selector, { offsetX: 10, offsetY: 10 }) .typeText(selector, newTitle, { replace: true }) @@ -112,7 +112,7 @@ frameworks.forEach((framework) => { assert.equal(json.items[0].title, newTitle); }); test("Check item reactiveness, for example required title", async (t) => { - const requiredTitleSelector = Selector(".sv_q_mt_title .sv_q_required_text"); + const requiredTitleSelector = Selector(".sd-multipletext__item-title .sd-question__required-text"); await t.expect(requiredTitleSelector.exists).notOk(); await ClientFunction(() => { window.survey.getAllQuestions()[0].items[0].isRequired = true; diff --git a/testCafe/questions/panel.js b/functionalTests/questions/panel.js similarity index 96% rename from testCafe/questions/panel.js rename to functionalTests/questions/panel.js index e133dd5e0a..24a32c25d3 100644 --- a/testCafe/questions/panel.js +++ b/functionalTests/questions/panel.js @@ -125,6 +125,7 @@ frameworks.forEach((framework) => { assert.equal(await contentItem.visible, true); await t.click(panelTitle); + await t.wait(1000); assert.equal(await contentItem.visible, false); }); test("expand collapse title by name", async (t) => { @@ -141,7 +142,7 @@ frameworks.forEach((framework) => { window["survey"].getAllPanels()[0].description = "desc1"; })(); await t - .expect(Selector(".sv_p_description").withText("desc1").visible).ok(); + .expect(Selector(".sd-panel__description").withText("desc1").visible).ok(); }); }); @@ -157,7 +158,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - var outerSelector = ".sv_p_title"; + var outerSelector = ".sd-panel__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -216,7 +217,7 @@ frameworks.forEach((framework) => { const setTitle = ClientFunction((title) => { window.survey.getAllPanels()[0].title = title; }); - const titleSelector = Selector(".sv_p_title"); + const titleSelector = Selector(".sd-panel__title"); await t.expect(titleSelector.exists).notOk(); await setTitle("panel title"); await t.expect(titleSelector.exists).ok().expect(titleSelector.find(".sv-string-viewer").innerText).eql("panel title"); diff --git a/testCafe/questions/paneldynamic.ts b/functionalTests/questions/paneldynamic.ts similarity index 94% rename from testCafe/questions/paneldynamic.ts rename to functionalTests/questions/paneldynamic.ts index 5189a95071..a6770d57e4 100644 --- a/testCafe/questions/paneldynamic.ts +++ b/functionalTests/questions/paneldynamic.ts @@ -1,4 +1,4 @@ -import { applyTheme, frameworks, url, url_test, initSurvey, getSurveyResult, getQuestionJson, +import { frameworks, url, initSurvey, getSurveyResult, getQuestionJson, getDynamicPanelRemoveButton, getListItemByText, completeButton, setData } from "../helper"; import { Selector, ClientFunction } from "testcafe"; const title = "paneldynamic"; @@ -146,15 +146,19 @@ const json = { frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json); } ); test("fill panel dynamic and add new panel", async (t) => { - const relativeTypeDropdown = Selector("div[data-name='relativeType'] .sv_q_dropdown_control"); - const ageDropdown = Selector("div[data-name='liveage'] .sv_q_dropdown_control"); - const deceasedAgeDropdown = Selector("div[data-name='deceasedage'] .sv_q_dropdown_control"); - const relativeillnessDropdown = Selector("div[data-name='relativeillness'] .sv_q_dropdown_control"); + const relativeTypeDropdown = Selector("div[data-name='relativeType'] .sd-dropdown"); + const ageDropdown = Selector("div[data-name='liveage'] .sd-dropdown"); + const deceasedAgeDropdown = Selector("div[data-name='deceasedage'] .sd-dropdown"); + const relativeillnessDropdown = Selector("div[data-name='relativeillness'] .sd-dropdown"); + + const nextButtonSelector = Selector("button").withAttribute("title", "Next"); + const prevButtonSelector = Selector("button").withAttribute("title", "Previous"); const addRowSelector = Selector("button").find("span").withText("Add Row"); await @@ -166,7 +170,7 @@ frameworks.forEach((framework) => { .click(Selector("body"), { offsetX: 1, offsetY: 1 }) .expect(ageDropdown.find(".sv-string-viewer").textContent).eql("72") - .click(".sv-paneldynamic__next-btn") + .click(nextButtonSelector) .click("input[value=\"Yes\"]") .click(ageDropdown) @@ -174,7 +178,7 @@ frameworks.forEach((framework) => { .click(Selector("body"), { offsetX: 1, offsetY: 1 }) .expect(ageDropdown.find(".sv-string-viewer").textContent).eql("65") - .click(Selector(".sv-paneldynamic__add-btn").withText("Add a blood relative")) + .click(Selector(".sd-paneldynamic__add-btn").withText("Add a blood relative")) .click(relativeTypeDropdown) .click(getListItemByText("sister")) @@ -187,8 +191,8 @@ frameworks.forEach((framework) => { .click(Selector("body"), { offsetX: 1, offsetY: 1 }) .expect(deceasedAgeDropdown.find(".sv-string-viewer").textContent).eql("42") .click("div[data-name='causeofdeathknown'] input[value=\"No\"]") - .click(".sv-paneldynamic__prev-btn") - .click(".sv-paneldynamic__prev-btn") + .click(prevButtonSelector) + .click(prevButtonSelector) .click(addRowSelector) @@ -199,7 +203,7 @@ frameworks.forEach((framework) => { .typeText("td[title=\"Describe\"] input[type=\"text\"]", "Type 2") .click(Selector("body"), { offsetX: 1, offsetY: 1 }) - .click(".sv-paneldynamic__next-btn") + .click(nextButtonSelector) .click(getDynamicPanelRemoveButton("Please enter all blood relatives you know", "Remove the relative")) .click(completeButton); @@ -231,13 +235,14 @@ frameworks.forEach((framework) => { frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json, undefined, true); } ); test("click on panel title state editable", async (t) => { const newTitle = "MyText"; - const outerSelector = ".sv_p_title"; + const outerSelector = ".sd-question__title"; const innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -263,9 +268,9 @@ const json2 = { }; frameworks.forEach((framework) => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { - await applyTheme("defaultV2"); + await t.resizeWindow(1920, 1080); await initSurvey(framework, json2); } ); @@ -317,9 +322,9 @@ const json3 = { ], }; frameworks.forEach((framework) => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { - await applyTheme("defaultV2"); + await t.resizeWindow(1920, 1080); await initSurvey(framework, json3); } ); @@ -329,6 +334,7 @@ frameworks.forEach((framework) => { await t .expect(addNewSelector.count).eql(1) .expect(Selector("span").withText("#1-2").visible).notOk() + .wait(500) .pressKey("b") .pressKey("tab") .expect(addNewSelector.count).eql(1) @@ -375,8 +381,9 @@ const jsonCheckboxRestFul = { }; frameworks.forEach((framework) => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { + await t.resizeWindow(1920, 1080); } ); diff --git a/functionalTests/questions/progressButtons.js b/functionalTests/questions/progressButtons.js new file mode 100644 index 0000000000..ad17d65a2e --- /dev/null +++ b/functionalTests/questions/progressButtons.js @@ -0,0 +1,51 @@ +import { frameworks, initSurvey, url } from "../helper"; +import { Selector, fixture, test } from "testcafe"; +const title = "progressButtons"; + +const json = { + pages: [ + { + name: "page1", + elements: [ + { + type: "text", + name: "question1" + } + ] + }, + { + name: "page2", + elements: [ + { + type: "text", + name: "question2" + } + ] + }, + { + name: "page3", + elements: [ + { + type: "text", + name: "question3" + } + ] + } + ], + showProgressBar: "top", + progressBarType: "buttons" +}; + +frameworks.forEach((framework) => { + fixture`${framework} ${title}` + .page`${url}${framework}`.beforeEach(async (t) => { + await initSurvey(framework, json); + }); + test("check progress buttons", async (t) => { + await t.hover(Selector("[data-name='question1']")); + await t.click(Selector("[title='page3']")); + await t.hover(Selector("[data-name='question3']")); + await t.click(Selector("[title='page2']")); + await t.hover(Selector("[data-name='question2']")); + }); +}); diff --git a/testCafe/questions/questions_comment.ts b/functionalTests/questions/questions_comment.ts similarity index 100% rename from testCafe/questions/questions_comment.ts rename to functionalTests/questions/questions_comment.ts diff --git a/testCafe/questions/radiogroup.js b/functionalTests/questions/radiogroup.js similarity index 96% rename from testCafe/questions/radiogroup.js rename to functionalTests/questions/radiogroup.js index 143c8f6076..27d6cd3b1c 100644 --- a/testCafe/questions/radiogroup.js +++ b/functionalTests/questions/radiogroup.js @@ -1,4 +1,4 @@ -import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, applyTheme, urlV2 } from "../helper"; +import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, urlV2 } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; // eslint-disable-next-line no-undef const assert = require("assert"); @@ -32,6 +32,7 @@ const json = { frameworks.forEach(framework => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, json); } ); @@ -49,7 +50,7 @@ frameworks.forEach(framework => { test("change column count", async t => { const getClassName = ClientFunction( - () => document.querySelector("div[id*=sq_1] fieldset .sv_q_select_column").className + () => document.querySelector("div[id*=sq_1] fieldset .sd-selectbase__column").className ); let className = await getClassName(); assert.notEqual(className.indexOf("sv-q-column-4"), -1); @@ -57,7 +58,7 @@ frameworks.forEach(framework => { await setOptions("car", { colCount: 1 }); const getClassNameOneCol = ClientFunction( - () => document.querySelector("div[id*=sq_1] fieldset > .sv_q_radiogroup").className + () => document.querySelector("div[id*=sq_1] fieldset > .sd-radio").className ); className = await getClassNameOneCol(); assert.notEqual(className.indexOf("sv-q-col-1"), -1); @@ -206,23 +207,23 @@ frameworks.forEach(framework => { const isCheckedClassExistsByIndex = ClientFunction(index => document .querySelector( - `fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(${index})` + `fieldset .sd-selectbase__column:nth-child(3) div:nth-of-type(${index})` ) - .classList.contains("checked") + .classList.contains("sd-radio--checked") ); assert.equal(await isCheckedClassExistsByIndex(2), false); assert.equal(await isCheckedClassExistsByIndex(3), false); await t.click( - "fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(2) label input" + "fieldset .sd-selectbase__column:nth-child(3) div:nth-of-type(2) label input" ); assert.equal(await isCheckedClassExistsByIndex(2), true); assert.equal(await isCheckedClassExistsByIndex(3), false); await t.click( - "fieldset .sv_q_select_column:nth-child(3) div:nth-of-type(3) label input" + "fieldset .sd-selectbase__column:nth-child(3) div:nth-of-type(3) label input" ); assert.equal(await isCheckedClassExistsByIndex(2), false); @@ -242,7 +243,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - const outerSelector = ".sv_q_title"; + const outerSelector = ".sd-question__title"; const innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -260,7 +261,7 @@ frameworks.forEach((framework) => { let questionValue = await getQuestionValue(); assert.equal(questionValue, undefined); - const selector = ".sv_q_radiogroup_label .sv-string-editor"; + const selector = ".sd-selectbase__label .sv-string-editor"; await t .click(selector) .typeText(selector, newTitle, { replace: true }) @@ -521,7 +522,7 @@ frameworks.forEach(framework => { assert.deepEqual(surveyResult, { q1: "item2", "q1-Comment": "ABCDEF" }); }); test("Do not clear comment area on clicking Clear button #8287", async t => { - const clearButton = Selector("input[value=Clear]"); + const clearButton = Selector("button[title=Clear]"); const currentJson = { elements: [ { @@ -576,7 +577,6 @@ frameworks.forEach((framework) => { }, ], }; - await applyTheme("defaultV2"); await initSurvey(framework, json); } ); diff --git a/testCafe/questions/ranking.js b/functionalTests/questions/ranking.js similarity index 98% rename from testCafe/questions/ranking.js rename to functionalTests/questions/ranking.js index a24867fd42..d4c1aaaeb2 100644 --- a/testCafe/questions/ranking.js +++ b/functionalTests/questions/ranking.js @@ -1,4 +1,4 @@ -import { frameworks, url, initSurvey, getData, setData, urlV2, applyTheme } from "../helper"; +import { frameworks, url, initSurvey, getData, setData, urlV2 } from "../helper"; import { Selector, fixture, test, ClientFunction } from "testcafe"; const title = "ranking"; @@ -354,7 +354,6 @@ frameworks.forEach((framework) => { }, ] }; - await applyTheme("defaultV2"); await initSurvey(framework, json); } ); @@ -387,7 +386,6 @@ frameworks.forEach((framework) => { }, ], }; - await applyTheme("defaultV2"); await initSurvey(framework, json); } ); diff --git a/testCafe/questions/rating.js b/functionalTests/questions/rating.js similarity index 94% rename from testCafe/questions/rating.js rename to functionalTests/questions/rating.js index 9f42e18415..75439095e2 100644 --- a/testCafe/questions/rating.js +++ b/functionalTests/questions/rating.js @@ -1,4 +1,4 @@ -import { frameworks, url, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, urlV2, applyTheme } from "../helper"; +import { frameworks, url, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, urlV2 } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; // eslint-disable-next-line no-undef const assert = require("assert"); @@ -55,7 +55,7 @@ frameworks.forEach((framework) => { var json = JSON.parse(await getQuestionJson()); assert.equal(await getQuestionValue(), null); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -73,7 +73,7 @@ frameworks.forEach((framework) => { var maxText = json.maxRateDescription; assert.equal(await getQuestionValue(), null); - var outerSelector = ".sv_q_rating .sv_q_rating_min_text"; + var outerSelector = ".sd-rating .sd-rating__min-text"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -93,7 +93,7 @@ frameworks.forEach((framework) => { var minText = json.minRateDescription; assert.equal(await getQuestionValue(), null); - var outerSelector = ".sv_q_rating .sv_q_rating_max_text"; + var outerSelector = ".sd-rating .sd-rating__max-text"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -150,12 +150,12 @@ frameworks.forEach((framework) => { ); }); test("check fixed width observability", async (t) => { - await t.expect(Selector(".sv_q_rating_item").withText("1").visible).ok(); - await t.expect(Selector(".sv_q_rating_item").withText("1").classNames).contains("sv_q_rating_item_fixed"); + await t.expect(Selector(".sd-rating__item").withText("1").visible).ok(); + await t.expect(Selector(".sd-rating__item").withText("1").classNames).contains("sd-rating__item--fixed-size"); await ClientFunction(() => { window["survey"].getQuestionByName("q1").renderedRateItems[1].locText.text = "a"; })(); - await t.expect(Selector(".sv_q_rating_item").withText("a").classNames).notContains("sv_q_rating_item_fixed"); + await t.expect(Selector(".sd-rating__item").withText("a").classNames).notContains("sd-rating__item--fixed-size"); await ClientFunction(() => { window["survey"].getQuestionByName("q1").renderedRateItems[2].locText.text = "b"; })(); - await t.expect(Selector(".sv_q_rating_item").withText("b").classNames).notContains("sv_q_rating_item_fixed"); + await t.expect(Selector(".sd-rating__item").withText("b").classNames).notContains("sd-rating__item--fixed-size"); }); const jsonStars = { @@ -283,11 +283,7 @@ frameworks.forEach((framework) => { }); frameworks.forEach((framework) => { - fixture`${framework} ${title}`.page`${urlV2}${framework}`.beforeEach( - async (ctx) => { - await applyTheme("defaultV2"); - } - ); + fixture`${framework} ${title}`.page`${urlV2}${framework}`; test("readonly", async (t) => { const json = { diff --git a/testCafe/questions/signature.ts b/functionalTests/questions/signature.ts similarity index 100% rename from testCafe/questions/signature.ts rename to functionalTests/questions/signature.ts diff --git a/testCafe/questions/tagbox.ts b/functionalTests/questions/tagbox.ts similarity index 95% rename from testCafe/questions/tagbox.ts rename to functionalTests/questions/tagbox.ts index 4cb9ac7ee9..c032938270 100644 --- a/testCafe/questions/tagbox.ts +++ b/functionalTests/questions/tagbox.ts @@ -1,4 +1,4 @@ -import { frameworks, url, initSurvey, getListItemByText, applyTheme, url_test } from "../helper"; +import { frameworks, url, initSurvey, getListItemByText } from "../helper"; import { Selector } from "testcafe"; const title = "tagbox"; @@ -90,10 +90,10 @@ const jsonCloseOnSelectIsDefault = { frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`; - const questionTagbox = Selector(".sv_q_input.sv_q_tagbox"); - const questionValueInput = Selector(".sv_q_tagbox__value input"); - const questionHint = Selector(".sv_q_tagbox__hint"); - const deleteItemButton = Selector(".sv_q_tagbox-item_clean-button"); + const questionTagbox = Selector(".sd-tagbox"); + const questionValueInput = Selector(".sd-tagbox__value input"); + const questionHint = Selector(".sd-tagbox__hint"); + const deleteItemButton = Selector(".sd-tagbox-item_clean-button"); const selectedItems = Selector(".sv-tagbox__item"); const popupContainer = Selector(".sv-popup__container").filterVisible(); @@ -228,7 +228,7 @@ frameworks.forEach((framework) => { .expect(selectedItems.count).eql(0) .click(questionTagbox) - .expect(popupContainer.offsetTop).within(70, 100); + .expect(popupContainer.offsetTop).within(170, 200); for (let i = 1; i < 27; i++) { await t.click(getListItemByText("item" + i.toString())); @@ -236,7 +236,7 @@ frameworks.forEach((framework) => { await t .expect(selectedItems.count).eql(26) - .expect(popupContainer.offsetTop).within(120, 240) + .expect(popupContainer.offsetTop).within(240, 360) .resizeWindow(1920, 1080); }); @@ -317,6 +317,7 @@ frameworks.forEach((framework) => { .pressKey("enter") .expect(selectedItems.nth(0).textContent).contains("item4") + .wait(100) .pressKey("down") .pressKey("down") .pressKey("down") @@ -463,8 +464,8 @@ frameworks.forEach((framework) => { .pressKey("esc") .expect(popupContainer.exists).notOk() - .click(".sv_next_btn") - .click(".sv_prev_btn") + .click(".sd-navigation__next-btn") + .click(".sd-navigation__prev-btn") .expect(popupContainer.exists).notOk() .click(questionTagbox) @@ -472,7 +473,7 @@ frameworks.forEach((framework) => { .pressKey("esc") .expect(selectedItems.count).eql(1) - .click(".sv_q_dropdown_clean-button") + .click(".sd-tagbox_clean-button") .expect(selectedItems.count).eql(0); }); @@ -506,8 +507,6 @@ frameworks.forEach((framework) => { .expect(selectedItems.nth(2).textContent).contains("United States"); }); - const theme = "defaultV2"; - function choicesLazyLoad(_, opt) { var getNumberArray = (skip = 1, count = 25) => { const result: Array = []; @@ -527,8 +526,7 @@ frameworks.forEach((framework) => { }, 500); } - test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height with lazy loading", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -625,8 +623,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height and position while searching", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -757,8 +754,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - test.page(`${url_test}${theme}/${framework}`)("Check popup height with lazy loading, if closeOnSelect is false", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height with lazy loading, if closeOnSelect is false", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -855,8 +851,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - test.page(`${url_test}${theme}/${framework}`)("Check popup height and position while searching, if closeOnSelect is false", async (t) => { - await applyTheme(theme); + test.page(`${url}${framework}`)("Check popup height and position while searching, if closeOnSelect is false", async (t) => { const json = { focusFirstQuestionAutomatic: true, questions: [ @@ -988,7 +983,7 @@ frameworks.forEach((framework) => { .resizeWindow(1280, 1100); }); - test.page(`${url_test}${theme}/${framework}`)("Check tagbox popup opens after beak click", async (t) => { + test.page(`${url}${framework}`)("Check tagbox popup opens after beak click", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { questions: [ @@ -1034,7 +1029,7 @@ frameworks.forEach((framework) => { .expect(popupContainer.visible).notOk(); }); - test.page(`${url_test}${theme}/${framework}`)("Check tagbox popup opens after beak click - search enabled", async (t) => { + test.page(`${url}${framework}`)("Check tagbox popup opens after beak click - search enabled", async (t) => { await t.resizeWindow(800, 600); const jsonWithDropDown = { questions: [ diff --git a/testCafe/questions/text.js b/functionalTests/questions/text.js similarity index 98% rename from testCafe/questions/text.js rename to functionalTests/questions/text.js index 26a69a4152..04ec7f2082 100644 --- a/testCafe/questions/text.js +++ b/functionalTests/questions/text.js @@ -172,7 +172,7 @@ frameworks.forEach((framework) => { var questionValue = await getQuestionValue(); await t.expect(questionValue).eql(undefined); - var outerSelector = ".sv_q_title"; + var outerSelector = ".sd-question__title"; var innerSelector = ".sv-string-editor"; await t .click(outerSelector) @@ -190,7 +190,7 @@ frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`; test("Remaining character counter", async (t) => { - const characterCounter = Selector(".sv-remaining-character-counter"); + const characterCounter = Selector(".sd-remaining-character-counter"); await initSurvey(framework, { focusFirstQuestionAutomatic: true, diff --git a/testCafe/resources/big_Dashka.jpg b/functionalTests/resources/big_Dashka.jpg similarity index 100% rename from testCafe/resources/big_Dashka.jpg rename to functionalTests/resources/big_Dashka.jpg diff --git a/testCafe/resources/small_Dashka.jpg b/functionalTests/resources/small_Dashka.jpg similarity index 100% rename from testCafe/resources/small_Dashka.jpg rename to functionalTests/resources/small_Dashka.jpg diff --git a/testCafe/resources/stub.txt b/functionalTests/resources/stub.txt similarity index 100% rename from testCafe/resources/stub.txt rename to functionalTests/resources/stub.txt diff --git a/testCafe/survey/afterRenderEvent.js b/functionalTests/survey/afterRenderEvent.js similarity index 84% rename from testCafe/survey/afterRenderEvent.js rename to functionalTests/survey/afterRenderEvent.js index f4fe491168..a97d7251a3 100644 --- a/testCafe/survey/afterRenderEvent.js +++ b/functionalTests/survey/afterRenderEvent.js @@ -1,4 +1,4 @@ -import { frameworks, url, initSurvey, url_test } from "../helper"; +import { frameworks, url, initSurvey } from "../helper"; import { ClientFunction, fixture, test, Selector } from "testcafe"; const title = "afterRenderQuestionEvent"; @@ -60,15 +60,16 @@ frameworks.forEach((framework) => { }; await initSurvey(framework, json, { onAfterRenderQuestion: f }); + const questionSelector = Selector(".sd-question"); await t - .expect(Selector(".sv_q.sv_qstn").count).eql(1) + .expect(questionSelector.count).eql(1) .click("input[value=valueYes]") - .expect(Selector(".sv_q.sv_qstn").count).eql(2) + .expect(questionSelector.count).eql(2) .expect(Selector("input[value='valueYes']").getStyleProperty("color")).eql("rgb(255, 99, 71)") - .expect(Selector(".sv_q.sv_qstn").nth(1).getStyleProperty("border-top-color")).eql("rgb(204, 204, 204)") - .expect(Selector(".sv_q.sv_qstn").nth(1).getStyleProperty("border-top-style")).eql("solid") - .expect(Selector(".sv_q.sv_qstn").nth(1).getStyleProperty("border-top-width")).eql("1px"); + .expect(questionSelector.nth(1).getStyleProperty("border-top-color")).eql("rgb(204, 204, 204)") + .expect(questionSelector.nth(1).getStyleProperty("border-top-style")).eql("solid") + .expect(questionSelector.nth(1).getStyleProperty("border-top-width")).eql("1px"); }); }); @@ -102,7 +103,7 @@ frameworks.forEach((framework) => { const checkResizeObserverExists = ClientFunction((modelName) => { return !!window[modelName].resizeObserver; }); - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach(async () => { + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach(async () => { await prepare(framework); }); (framework === "angular" || framework === "react" ? test : test.skip)("Check that survey calls afterRender if model changed", async (t) => { diff --git a/testCafe/survey/afterRenderEvent.ts b/functionalTests/survey/afterRenderEvent.ts similarity index 89% rename from testCafe/survey/afterRenderEvent.ts rename to functionalTests/survey/afterRenderEvent.ts index 80ab478361..f5d477a4a9 100644 --- a/testCafe/survey/afterRenderEvent.ts +++ b/functionalTests/survey/afterRenderEvent.ts @@ -1,5 +1,5 @@ import { ClientFunction, Selector } from "testcafe"; -import { frameworks, url_test, initSurvey } from "../helper"; +import { frameworks, url, initSurvey } from "../helper"; const title = "afterRenderQuestionEvent"; @@ -34,7 +34,7 @@ const json = { }; frameworks.forEach((framework) => { - fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach(async (t) => { + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach(async (t) => { await t.resizeWindow(1920, 1080); }); test("afterRender is not fired when questions are lazy rendered", async (t) => { diff --git a/testCafe/survey/afterRenderQuestionInputEvent.js b/functionalTests/survey/afterRenderQuestionInputEvent.js similarity index 100% rename from testCafe/survey/afterRenderQuestionInputEvent.js rename to functionalTests/survey/afterRenderQuestionInputEvent.js diff --git a/testCafe/survey/autoNextPage.js b/functionalTests/survey/autoNextPage.js similarity index 100% rename from testCafe/survey/autoNextPage.js rename to functionalTests/survey/autoNextPage.js diff --git a/testCafe/survey/changeRendering.js b/functionalTests/survey/changeRendering.js similarity index 100% rename from testCafe/survey/changeRendering.js rename to functionalTests/survey/changeRendering.js diff --git a/testCafe/survey/composite_components.ts b/functionalTests/survey/composite_components.ts similarity index 100% rename from testCafe/survey/composite_components.ts rename to functionalTests/survey/composite_components.ts diff --git a/testCafe/survey/cookie.js b/functionalTests/survey/cookie.js similarity index 91% rename from testCafe/survey/cookie.js rename to functionalTests/survey/cookie.js index 5cf292baf4..532b74c25a 100644 --- a/testCafe/survey/cookie.js +++ b/functionalTests/survey/cookie.js @@ -48,10 +48,10 @@ frameworks.forEach(framework => { .navigateTo(url + framework); await initSurvey(framework, json); - await t.expect(Selector(".sv_body h3").withText("You have already completed this survey.").visible).ok(); + await t.expect(Selector(".sd-body h3").withText("You have already completed this survey.").visible).ok(); await deleteCookie(); await t.hover("input[type=checkbox]"); - await t.expect(Selector(".sv_body h3").withText("You have already completed this survey.").exist).notOk(); + await t.expect(Selector(".sd-body h3").withText("You have already completed this survey.").exist).notOk(); }); }); diff --git a/testCafe/survey/customCss.js b/functionalTests/survey/customCss.js similarity index 86% rename from testCafe/survey/customCss.js rename to functionalTests/survey/customCss.js index 280d6e831c..cab8370947 100644 --- a/testCafe/survey/customCss.js +++ b/functionalTests/survey/customCss.js @@ -2,13 +2,6 @@ import { frameworks, url } from "../helper"; import { ClientFunction, Selector, fixture, test } from "testcafe"; const title = "customCss"; const initSurvey = ClientFunction((framework, json) => { - if (typeof window["Survey"].defaultBootstrapCss !== "undefined") { - window["Survey"].defaultBootstrapCss.navigationButton = "btn btn-primary"; - } else if (!!window["SurveyBootstrap"] && typeof window["SurveyBootstrap"].defaultBootstrapCss !== "undefined") { - window["SurveyBootstrap"].defaultCss.navigationButton = "btn btn-primary"; - } - window["Survey"].StylesManager.applyTheme("bootstrap"); - var model = new window["Survey"].Model(json); model.onComplete.add(function (model) { diff --git a/testCafe/survey/customNavigation.js b/functionalTests/survey/customNavigation.js similarity index 100% rename from testCafe/survey/customNavigation.js rename to functionalTests/survey/customNavigation.js diff --git a/testCafe/survey/custom_components.ts b/functionalTests/survey/custom_components.ts similarity index 87% rename from testCafe/survey/custom_components.ts rename to functionalTests/survey/custom_components.ts index 513ff65eb2..8247e418cc 100644 --- a/testCafe/survey/custom_components.ts +++ b/functionalTests/survey/custom_components.ts @@ -1,7 +1,6 @@ -import { url_test, initSurvey, getSurveyResult, frameworks } from "../helper"; +import { initSurvey, getSurveyResult, frameworks, url } from "../helper"; import { Selector, ClientFunction } from "testcafe"; const title = "Custom Components"; -const themeName = "defaultV2"; const json = { "elements": [ { @@ -27,7 +26,7 @@ const registerNPSComponet = ClientFunction(() => { }); frameworks.forEach(framework => { - fixture`${framework} ${title}`.page`${url_test}${themeName}/${framework}`.beforeEach( + fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { } ); diff --git a/testCafe/survey/elementsVisibility.js b/functionalTests/survey/elementsVisibility.js similarity index 100% rename from testCafe/survey/elementsVisibility.js rename to functionalTests/survey/elementsVisibility.js diff --git a/testCafe/survey/elementsVisibilityOnSameRow.js b/functionalTests/survey/elementsVisibilityOnSameRow.js similarity index 100% rename from testCafe/survey/elementsVisibilityOnSameRow.js rename to functionalTests/survey/elementsVisibilityOnSameRow.js diff --git a/testCafe/survey/focusFirstQuestionAutomatic.ts b/functionalTests/survey/focusFirstQuestionAutomatic.ts similarity index 99% rename from testCafe/survey/focusFirstQuestionAutomatic.ts rename to functionalTests/survey/focusFirstQuestionAutomatic.ts index 71742c7405..11e3870c1a 100644 --- a/testCafe/survey/focusFirstQuestionAutomatic.ts +++ b/functionalTests/survey/focusFirstQuestionAutomatic.ts @@ -92,6 +92,7 @@ frameworks.forEach(async framework => { ] }); await focusQuestion("panel1_q1", false); + await t.wait(1000); await t.expect(panel1_q1Sel.filter(filterIsInViewport).exists).ok() .pressKey("a"); await focusQuestion("q1", false); diff --git a/testCafe/survey/focusQuestionEvent.ts b/functionalTests/survey/focusQuestionEvent.ts similarity index 99% rename from testCafe/survey/focusQuestionEvent.ts rename to functionalTests/survey/focusQuestionEvent.ts index 424307473c..208f2d319e 100644 --- a/testCafe/survey/focusQuestionEvent.ts +++ b/functionalTests/survey/focusQuestionEvent.ts @@ -34,7 +34,7 @@ frameworks.forEach(async framework => { window["raisedFocusEvent"] = true; }); })(); - await t.click(Selector(".sv_qstn input").nth(1)); + await t.click(Selector(".sd-question input").nth(1)); await t.expect(ClientFunction(() => window["raisedFocusEvent"])()).ok(); }); diff --git a/testCafe/survey/goNextPageAutomatic.ts b/functionalTests/survey/goNextPageAutomatic.ts similarity index 100% rename from testCafe/survey/goNextPageAutomatic.ts rename to functionalTests/survey/goNextPageAutomatic.ts diff --git a/testCafe/survey/hasComment.js b/functionalTests/survey/hasComment.js similarity index 100% rename from testCafe/survey/hasComment.js rename to functionalTests/survey/hasComment.js diff --git a/testCafe/survey/lazyRendering.ts b/functionalTests/survey/lazyRendering.ts similarity index 100% rename from testCafe/survey/lazyRendering.ts rename to functionalTests/survey/lazyRendering.ts diff --git a/testCafe/survey/localization.js b/functionalTests/survey/localization.js similarity index 98% rename from testCafe/survey/localization.js rename to functionalTests/survey/localization.js index 3fc17bdb30..0cc0d7a8ca 100644 --- a/testCafe/survey/localization.js +++ b/functionalTests/survey/localization.js @@ -125,7 +125,7 @@ frameworks.forEach(framework => { }); test("check dropdown localization", async t => { - const questionDropdownSelect = Selector(".sv_q_dropdown_control"); + const questionDropdownSelect = Selector(".sd-dropdown"); await t .click(questionDropdownSelect) .expect(getListItemByText("en1").visible).ok() diff --git a/testCafe/survey/navigation.js b/functionalTests/survey/navigation.js similarity index 94% rename from testCafe/survey/navigation.js rename to functionalTests/survey/navigation.js index 44306fa5c7..02d548a0f7 100644 --- a/testCafe/survey/navigation.js +++ b/functionalTests/survey/navigation.js @@ -1,4 +1,4 @@ -import { frameworks, url, url_test, initSurvey, applyTheme } from "../helper"; +import { frameworks, url, initSurvey } from "../helper"; import { ClientFunction, fixture, Selector, test } from "testcafe"; const title = "navigation"; @@ -132,6 +132,7 @@ const scrollJson = { frameworks.forEach((framework) => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async (t) => { + await t.resizeWindow(1920, 1080); await initSurvey(framework, tocJson); } ); @@ -146,12 +147,10 @@ frameworks.forEach((framework) => { }); frameworks.forEach((framework) => { - const theme = "defaultV2"; - fixture`${framework} ${title} ${theme}` - .page`${url_test}${theme}/${framework}`; + fixture`${framework} ${title}` + .page`${url}${framework}`; test("Page should be scrolled to top of survey", async (t) => { - await applyTheme(theme); await initSurvey(framework, scrollJson); await t.scrollIntoView(Selector("input[value=Next]")); @@ -160,7 +159,6 @@ frameworks.forEach((framework) => { }); test("Page should be scrolled to top of survey fit to container", async (t) => { - await applyTheme(theme); await initSurvey(framework, scrollJson); await ClientFunction(() => { diff --git a/testCafe/survey/options.js b/functionalTests/survey/options.js similarity index 86% rename from testCafe/survey/options.js rename to functionalTests/survey/options.js index 2adcd5ed07..843eadba57 100644 --- a/testCafe/survey/options.js +++ b/functionalTests/survey/options.js @@ -125,7 +125,7 @@ frameworks.forEach(framework => { ); test("change question required text", async t => { - const requiredElement = Selector(".sv_q_required_text"); + const requiredElement = Selector(".sd-question__required-text"); await t.expect(requiredElement.textContent).eql("*"); await change_question_required_text(); @@ -133,7 +133,7 @@ frameworks.forEach(framework => { }); test("set question numbers on page", async t => { - const questionNumber = Selector(".sv_q_num"); + const questionNumber = Selector(".sd-element__num"); await t .click("input[type=checkbox]") @@ -145,7 +145,7 @@ frameworks.forEach(framework => { }); test("set question numbers off", async t => { - const questionNumber = Selector(".sv_q_num"); + const questionNumber = Selector(".sd-element__num"); await t.expect(questionNumber.textContent).eql("1."); await set_question_numbers_off(); @@ -167,7 +167,7 @@ frameworks.forEach(framework => { }); test("show page numbers", async t => { - const pageTitle = Selector(".sv_page_title"); + const pageTitle = Selector(".sd-page__title"); const pageTitleText = "What operating system do you use?"; await t.expect(pageTitle.textContent).contains(pageTitleText); @@ -182,14 +182,15 @@ frameworks.forEach(framework => { .expect(pageTitle.textContent).contains("What language(s) are you currently using?"); }); - const progressbar = Selector(".sv_progress").filterVisible(); + const progressbar = Selector(".sd-progress").filterVisible(); test("no progress bar", async t => { await t.expect(progressbar.exists).notOk(); }); test("show top progress bar", async t => { - let progressSelector = ".sv_container .sv-components-column--expandable > .sv-components-column > div"; + await ClientFunction(() => window.Survey.surveyCss.currentType = "")(); + let progressSelector = ".sd-container-modern .sv-components-column--expandable > .sv-components-column > div"; // if(framework === "vue3") { // progressSelector = ".sv_container .sv-components-column--expandable > div"; // } @@ -200,11 +201,12 @@ frameworks.forEach(framework => { await t .expect(progressbar.visible).ok() .expect(progressbar.textContent).contains("Page 1 of 3") - .expect(progressElement.classNames).contains("sv_progress"); + .expect(progressElement.classNames).contains("sd-progress"); }); test("show bottom progress bar", async t => { - const progressRootElement = Selector(".sv_main > div > form > .sv_container .sv-components-row ~ div"); + await ClientFunction(() => window.Survey.surveyCss.currentType = "")(); + const progressRootElement = Selector(".sd-root-modern > div > form > .sd-container-modern .sv-components-row ~ div"); await t.expect(progressbar.exists).notOk(); await show_bottom_progress_bar(); @@ -212,13 +214,14 @@ frameworks.forEach(framework => { .expect(progressbar.visible).ok() .expect(progressbar.textContent).contains("Page 1 of 3"); if(framework === "vue") { - await t.expect(progressRootElement.find(".sv_progress").visible).ok(); + await t.expect(progressRootElement.find(".sd-progress").visible).ok(); } else { - await t.expect(progressRootElement.classNames).contains("sv_progress"); + await t.expect(progressRootElement.classNames).contains("sd-progress"); } }); test("check progress bar page 2", async t => { + await ClientFunction(() => window.Survey.surveyCss.currentType = "")(); await t.expect(progressbar.exists).notOk(); await show_top_progress_bar(); await t @@ -237,11 +240,11 @@ frameworks.forEach(framework => { .click("input[type=checkbox]") .click("input[value=\"Next\"]") .click("input[value=\"Complete\"]") - .expect(Selector(".sv_completed_page h1").withText("Wombat").visible).ok(); + .expect(Selector(".sd-completedpage h1").withText("Wombat").visible).ok(); }); test("check previous", async t => { - const pageTitle = Selector(".sv_page_title .sv-string-viewer"); + const pageTitle = Selector(".sd-page__title .sv-string-viewer"); await t .click("input[type=checkbox]") diff --git a/testCafe/survey/page.js b/functionalTests/survey/page.js similarity index 90% rename from testCafe/survey/page.js rename to functionalTests/survey/page.js index d6d59601fb..a53d538214 100644 --- a/testCafe/survey/page.js +++ b/functionalTests/survey/page.js @@ -12,7 +12,7 @@ frameworks.forEach(framework => { }); const addPageDescriptionClass = ClientFunction( - () => (window["Survey"].defaultStandardCss.page.description = "sv_page_description") + () => (Survey.defaultV2Css.page.description = "sv_page_description") ); test("page title", async t => { @@ -32,10 +32,10 @@ frameworks.forEach(framework => { }; await initSurvey(framework, json); - await t.expect(Selector(".sv_page_title").exists).ok(); + await t.expect(Selector(".sd-page__title").exists).ok(); await setSurveyInDesignMode(); - await t.expect(Selector(".sv_page_title").exists).ok(); + await t.expect(Selector(".sd-page__title").exists).ok(); }); test("page description", async t => { @@ -80,9 +80,9 @@ frameworks.forEach(framework => { await initSurvey(framework, json); - await t.expect(Selector(".sv_page_title").exists).notOk(); + await t.expect(Selector(".sd-page__title").exists).notOk(); await setSurveyInDesignMode(); - await t.expect(Selector(".sv_page_title").exists).ok(); + await t.expect(Selector(".sd-page__title").exists).ok(); }); test("page description empty", async t => { diff --git a/testCafe/survey/popup.js b/functionalTests/survey/popup.js similarity index 96% rename from testCafe/survey/popup.js rename to functionalTests/survey/popup.js index 54d19f0afa..06f4a7b74b 100644 --- a/testCafe/survey/popup.js +++ b/functionalTests/survey/popup.js @@ -95,8 +95,8 @@ frameworks.forEach(framework => { await t .expect(expandCollapseButton.visible).ok() .click(expandCollapseButton) - .click(Selector(".sv_q_checkbox_control_label").withText("Nissan")) - .click(Selector(".sv_q_checkbox_control_label").withText("Audi")) + .click(Selector(".sd-item__control-label").withText("Nissan")) + .click(Selector(".sd-item__control-label").withText("Audi")) .click("input[value=Complete]"); surveyResult = await getSurveyResult(); @@ -157,7 +157,7 @@ frameworks.forEach(framework => { }); const expandCollapseButton = Selector(".sv_window_button_collapse"); await t.click(expandCollapseButton) - .click(Selector(".sv_q_dropdown__filter-string-input")) + .click(Selector(".sd-dropdown__filter-string-input")) .expect(Selector(".sv-popup__container").filterVisible().exists).ok() .scroll(Selector(".sv_window").filterVisible(), "bottom") .expect(Selector(".sv-popup__container").filterVisible().exists).notOk(); diff --git a/testCafe/survey/preprocessTitlesAndHtml.js b/functionalTests/survey/preprocessTitlesAndHtml.js similarity index 92% rename from testCafe/survey/preprocessTitlesAndHtml.js rename to functionalTests/survey/preprocessTitlesAndHtml.js index 66d86a1e3a..ee27abf978 100644 --- a/testCafe/survey/preprocessTitlesAndHtml.js +++ b/functionalTests/survey/preprocessTitlesAndHtml.js @@ -66,10 +66,10 @@ frameworks.forEach(framework => { const getcompletedHtml = "Thank you for sharing this information with us.Your name is: wombatYour email is: wombat@mail.mailThis is what is on your mind:fresh grasses"; const getFirstInput = Selector( - () => document.querySelectorAll(".sv_q_text_root")[0] + () => document.querySelectorAll(".sd-text")[0] ); const getSecondInput = Selector( - () => document.querySelectorAll(".sv_q_text_root")[1] + () => document.querySelectorAll(".sd-text")[1] ); await t.hover(getFirstTitle).hover(getSecondTitle); @@ -83,6 +83,6 @@ frameworks.forEach(framework => { .hover(getThirdTitle) .typeText("textarea", "fresh grasses") .click("input[value=\"Complete\"]") - .expect(Selector(".sv_completed_page").textContent).eql(getcompletedHtml); + .expect(Selector(".sd-completedpage").textContent).eql(getcompletedHtml); }); }); diff --git a/testCafe/survey/progressBarType.ts b/functionalTests/survey/progressBarType.ts similarity index 95% rename from testCafe/survey/progressBarType.ts rename to functionalTests/survey/progressBarType.ts index e1c8c21cdb..995c78f2e5 100644 --- a/testCafe/survey/progressBarType.ts +++ b/functionalTests/survey/progressBarType.ts @@ -106,6 +106,7 @@ const json_toc = { frameworks.forEach(async framework => { fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach( async t => { + await t.resizeWindow(1920, 1080); } ); test("progressBarType:questions", async t => { @@ -128,7 +129,8 @@ frameworks.forEach(async framework => { const page2 = Selector(".sv-list__item-body").withText("page2"); await t.expect(page1.exists).ok(); await t.expect(page2.exists).ok(); + await t.wait(500); await t.click(page2); - await t.expect(Selector("h5.sv_q_title").withText("q3").exists).ok(); + await t.expect(Selector("h5.sd-question__title").withText("q3").exists).ok(); }); }); \ No newline at end of file diff --git a/testCafe/survey/questionTitlePattern.js b/functionalTests/survey/questionTitlePattern.js similarity index 100% rename from testCafe/survey/questionTitlePattern.js rename to functionalTests/survey/questionTitlePattern.js diff --git a/testCafe/survey/questionsInOneLine.js b/functionalTests/survey/questionsInOneLine.js similarity index 97% rename from testCafe/survey/questionsInOneLine.js rename to functionalTests/survey/questionsInOneLine.js index 51d2bd1f53..22f935cae6 100644 --- a/testCafe/survey/questionsInOneLine.js +++ b/functionalTests/survey/questionsInOneLine.js @@ -63,7 +63,7 @@ frameworks.forEach((framework) => { await t .expect(cityElement.exists).ok() .expect(stateElement.exists).ok() - .expect(Selector(".sv_q").count).eql(6); + .expect(Selector(".sd-question").count).eql(6); // await t.expect(await isOneLine()).ok(); }); diff --git a/testCafe/survey/questionsInOneLineVisibility.js b/functionalTests/survey/questionsInOneLineVisibility.js similarity index 81% rename from testCafe/survey/questionsInOneLineVisibility.js rename to functionalTests/survey/questionsInOneLineVisibility.js index 2033d72339..9b801f55ce 100644 --- a/testCafe/survey/questionsInOneLineVisibility.js +++ b/functionalTests/survey/questionsInOneLineVisibility.js @@ -1,4 +1,4 @@ -import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; +import { frameworks, url, initSurvey } from "../helper"; import { Selector, fixture, test } from "testcafe"; const title = "questionsInOneLine and question visibility"; @@ -31,9 +31,8 @@ const json = { }; frameworks.forEach((framework) => { - fixture`${framework} ${title} modern` - .page`${url_test}modern/${framework}`.beforeEach(async (t) => { - await applyTheme("modern"); + fixture`${framework} ${title}` + .page`${url}${framework}`.beforeEach(async (t) => { await initSurvey(framework, json); }); @@ -43,7 +42,7 @@ frameworks.forEach((framework) => { await t.click(Selector("span").withText("item 1")); await t .expect( - Selector("h5.sv-question__title--answer") + Selector("h5.sd-question__title--answer") .find("span") .withText("q1").exists ) @@ -52,7 +51,7 @@ frameworks.forEach((framework) => { await t.click(Selector("span").withText("item 4")); await t .expect( - Selector("h5.sv-question__title--answer") + Selector("h5.sd-question__title--answer") .find("span") .withText("q2").exists ) diff --git a/testCafe/survey/questionsIsAnswered.js b/functionalTests/survey/questionsIsAnswered.js similarity index 57% rename from testCafe/survey/questionsIsAnswered.js rename to functionalTests/survey/questionsIsAnswered.js index a925394942..ae537aeb28 100644 --- a/testCafe/survey/questionsIsAnswered.js +++ b/functionalTests/survey/questionsIsAnswered.js @@ -1,5 +1,5 @@ -import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; -import { Selector, ClientFunction, fixture, test } from "testcafe"; +import { frameworks, url, initSurvey } from "../helper"; +import { Selector, fixture, test } from "testcafe"; const title = "questions isAnswered title style"; const json = { @@ -12,34 +12,33 @@ const json = { }; frameworks.forEach((framework) => { - fixture`${framework} ${title} modern` - .page`${url_test}modern/${framework}`.beforeEach(async (t) => { - await applyTheme("modern"); + fixture`${framework} ${title}` + .page`${url}${framework}`.beforeEach(async (t) => { await initSurvey(framework, json); }); test("Check is Answered title css class", async (t) => { - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q1").exists).notOk(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q1").exists).notOk(); await t.click(Selector("span").withText("item 1")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q1").exists).ok(); - await t.click(Selector("input[value=Clear]")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q1").exists).notOk(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q1").exists).ok(); + await t.click(Selector("button[title=Clear]")); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q1").exists).notOk(); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q2").exists).ok(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q2").exists).ok(); await t.click(Selector("span").withText("item 3")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q2").exists).ok(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q2").exists).ok(); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q3").exists).notOk(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q3").exists).notOk(); await t.click(Selector("span").withText("item 5")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q3").exists).ok(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q3").exists).ok(); await t.click(Selector("span").withText("item 5")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q3").exists).notOk(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q3").exists).notOk(); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q4").exists).ok(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q4").exists).ok(); await t.click(Selector("span").withText("item 8")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q4").exists).ok(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q4").exists).ok(); await t.click(Selector("span").withText("item 7")); await t.click(Selector("span").withText("item 8")); - await t.expect(Selector("h5.sv-question__title--answer").find("span").withText("q4").exists).notOk(); + await t.expect(Selector("h5.sd-question__title--answer").find("span").withText("q4").exists).notOk(); }); }); diff --git a/testCafe/survey/responsiveness.js b/functionalTests/survey/responsiveness.js similarity index 89% rename from testCafe/survey/responsiveness.js rename to functionalTests/survey/responsiveness.js index ecb29ab0f9..b068547ae3 100644 --- a/testCafe/survey/responsiveness.js +++ b/functionalTests/survey/responsiveness.js @@ -1,4 +1,4 @@ -import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; +import { frameworks, initSurvey, url } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; const title = "Survey responsiveness"; @@ -11,12 +11,9 @@ var json = { ], }; -const themeName = "defaultV2"; - frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { - await applyTheme(themeName); + .page`${url}${framework}`.beforeEach(async (t) => { await initSurvey(framework, json); await t.resizeWindow(1000, 1000); }); @@ -39,8 +36,7 @@ frameworks.forEach((framework) => { frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { - await applyTheme(themeName); + .page`${url}${framework}`.beforeEach(async (t) => { }); test("check rating question in survey with multiple pages on small screen", async (t) => { await ClientFunction(() => { window.addEventListener("error", e => { diff --git a/testCafe/survey/showPreview.js b/functionalTests/survey/showPreview.js similarity index 100% rename from testCafe/survey/showPreview.js rename to functionalTests/survey/showPreview.js diff --git a/testCafe/survey/skipToQuestion.js b/functionalTests/survey/skipToQuestion.js similarity index 100% rename from testCafe/survey/skipToQuestion.js rename to functionalTests/survey/skipToQuestion.js diff --git a/testCafe/survey/skipToQuestion2.js b/functionalTests/survey/skipToQuestion2.js similarity index 100% rename from testCafe/survey/skipToQuestion2.js rename to functionalTests/survey/skipToQuestion2.js diff --git a/testCafe/survey/startedPage.js b/functionalTests/survey/startedPage.js similarity index 100% rename from testCafe/survey/startedPage.js rename to functionalTests/survey/startedPage.js diff --git a/testCafe/survey/survey.js b/functionalTests/survey/survey.js similarity index 84% rename from testCafe/survey/survey.js rename to functionalTests/survey/survey.js index 3c04baf3db..47ffb2f85f 100644 --- a/testCafe/survey/survey.js +++ b/functionalTests/survey/survey.js @@ -1,4 +1,4 @@ -import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; +import { frameworks, initSurvey, url } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; const title = "Survey"; @@ -28,12 +28,9 @@ var json = { ] }; -const themeName = "defaultV2"; - frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { - await applyTheme(themeName); + .page`${url}${framework}`.beforeEach(async (t) => { await initSurvey(framework, json); await t.resizeWindow(1600, 900); }); @@ -88,7 +85,7 @@ frameworks.forEach((framework) => { frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { + .page`${url}${framework}`.beforeEach(async (t) => { await t.resizeWindow(1600, 900); }); test("Check matrix fail when showing preview", async (t) => { @@ -186,31 +183,31 @@ frameworks.forEach((framework) => { }, ], }); - await applyTheme({ - backgroundImage: - "https://api.surveyjs.io/private/Surveys/files?name=4ffde38f-2bb3-4f57-aa0d-d5c7003e8ab1", - backgroundImageFit: "cover", - backgroundImageAttachment: "scroll", - header: { - height: 256, - inheritWidthFrom: "container", - textAreaWidth: 512, - overlapEnabled: false, - backgroundImageOpacity: 1, - backgroundImageFit: "cover", - logoPositionX: "right", - logoPositionY: "top", - titlePositionX: "left", - titlePositionY: "bottom", - descriptionPositionX: "left", - descriptionPositionY: "bottom", - }, - themeName: "molisana", - isPanelless: false, - colorPalette: "light", - cssVariables: { - }, - }); + // await applyTheme({ + // backgroundImage: + // "https://api.surveyjs.io/private/Surveys/files?name=4ffde38f-2bb3-4f57-aa0d-d5c7003e8ab1", + // backgroundImageFit: "cover", + // backgroundImageAttachment: "scroll", + // header: { + // height: 256, + // inheritWidthFrom: "container", + // textAreaWidth: 512, + // overlapEnabled: false, + // backgroundImageOpacity: 1, + // backgroundImageFit: "cover", + // logoPositionX: "right", + // logoPositionY: "top", + // titlePositionX: "left", + // titlePositionY: "bottom", + // descriptionPositionX: "left", + // descriptionPositionY: "bottom", + // }, + // themeName: "molisana", + // isPanelless: false, + // colorPalette: "light", + // cssVariables: { + // }, + // }); await t.expect(Selector(".sd-title").visible).ok(); await t.expect(Selector(".sv-header").visible).notOk(); }); diff --git a/testCafe/survey/surveyWidth.ts b/functionalTests/survey/surveyWidth.ts similarity index 80% rename from testCafe/survey/surveyWidth.ts rename to functionalTests/survey/surveyWidth.ts index 9324489aff..9e3e2f9846 100644 --- a/testCafe/survey/surveyWidth.ts +++ b/functionalTests/survey/surveyWidth.ts @@ -21,15 +21,15 @@ frameworks.forEach((framework) => { test("Check survey width", async (t) => { await t - .expect(Selector(".sv_body").getStyleProperty("max-width")).eql("455px"); + .expect(Selector(".sd-body").getStyleProperty("max-width")).eql("455px"); }); test("Check question width", async (t) => { await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100%, 300px)"); + .expect(Selector(".sd-row > div").getStyleProperty("min-width")).eql("min(100%, 300px)"); await ClientFunction(() => { window["survey"].getAllQuestions()[0].minWidth = "200px"; })(); await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100%, 200px)"); + .expect(Selector(".sd-row > div").getStyleProperty("min-width")).eql("min(100%, 200px)"); }); }); \ No newline at end of file diff --git a/testCafe/survey/svgRegistry.ts b/functionalTests/survey/svgRegistry.ts similarity index 100% rename from testCafe/survey/svgRegistry.ts rename to functionalTests/survey/svgRegistry.ts diff --git a/testCafe/survey/textMarkdown.ts b/functionalTests/survey/textMarkdown.ts similarity index 91% rename from testCafe/survey/textMarkdown.ts rename to functionalTests/survey/textMarkdown.ts index 20ca31ef89..2799275b65 100644 --- a/testCafe/survey/textMarkdown.ts +++ b/functionalTests/survey/textMarkdown.ts @@ -47,13 +47,13 @@ frameworks.forEach((framework) => { await t.expect(surveyResult.question1).eql([2]); }); test("Check Text Markdown on dropdown", async (t) => { - const questionValueText = Selector(".sv_q_dropdown__value .sv-string-viewer"); - + const questionValueText = Selector(".sd-dropdown__value .sv-string-viewer"); + const questionDropdownSelect = Selector(".sd-dropdown"); await t - .click(Selector(".sv_q_dropdown_control")) + .click(questionDropdownSelect) .click(Selector(".markdownclass").withText("*choice 3*")) .expect(questionValueText.textContent).eql("*choice 3*") - .click(Selector(".sv_q_dropdown_control")) + .click(questionDropdownSelect) .click(Selector(".markdownclass").withText("*choice 2*")) .click("input[value=Complete]"); diff --git a/testCafe/survey/titleActions.js b/functionalTests/survey/titleActions.js similarity index 88% rename from testCafe/survey/titleActions.js rename to functionalTests/survey/titleActions.js index 02e5de76e5..202c9cbbbc 100644 --- a/testCafe/survey/titleActions.js +++ b/functionalTests/survey/titleActions.js @@ -1,4 +1,4 @@ -import { frameworks, url, initSurvey, url_test, applyTheme } from "../helper"; +import { frameworks, url, initSurvey } from "../helper"; import { Selector, ClientFunction, fixture, test } from "testcafe"; const title = "titleActions"; @@ -83,8 +83,8 @@ frameworks.forEach((framework) => { }); await t .expect(Selector("h5 use").nth(1).getAttribute("xlink:href")).eql("#icon-action") - .expect(Selector("h5 button span.sv-action-bar-item__title").hasClass("sv-action-bar-item__title--with-icon")).ok() - .expect(Selector("h5 button .sv-action-bar-item__icon").getStyleProperty("width")).eql("20px"); + .expect(Selector("h5 button span.sd-action__title").hasClass("sv-action-bar-item__title--with-icon")).ok() + .expect(Selector("h5 button .sd-action__icon").getStyleProperty("width")).eql("20px"); }); test("check item with showTitle false", async (t) => { @@ -117,7 +117,7 @@ frameworks.forEach((framework) => { }, }); - await t.expect(Selector("h5 .sv-action span.sv-action-bar-item__title").exists).ok(); + await t.expect(Selector("h5 .sv-action span.sd-action__title").exists).ok(); }); test("check action with separator", async (t) => { @@ -151,31 +151,34 @@ frameworks.forEach((framework) => { }); test("check expand/collapse action", async (t) => { - const elementTitle = Selector(".sv_q_title"); + const elementTitle = Selector(".sd-question__title"); const getQuestionState = ClientFunction(() => { return window["survey"].getAllQuestions()[0].state; }); + const expandableClass = "sd-element__title--expandable"; + const expandedClass = "sd-element__title--expanded"; + const collapsedClass = "sd-element__title--collapsed"; await initSurvey(framework, json, { onGetQuestionTitleActions: (_, opt) => { }, }); await t - .expect(elementTitle.hasClass("sv_q_title_expandable")).ok() - .expect(elementTitle.hasClass("sv_q_title_expanded")).notOk() - .expect(elementTitle.hasClass("sv_q_title_collapsed")).ok(); + .expect(elementTitle.hasClass(expandableClass)).ok() + .expect(elementTitle.hasClass(expandedClass)).notOk() + .expect(elementTitle.hasClass(collapsedClass)).ok(); await t.expect(await getQuestionState()).eql("collapsed"); await t .click(elementTitle) - .expect(elementTitle.hasClass("sv_q_title_expandable")).ok() - .expect(elementTitle.hasClass("sv_q_title_expanded")).ok() - .expect(elementTitle.hasClass("sv_q_title_collapsed")).notOk(); + .expect(elementTitle.hasClass(expandableClass)).ok() + .expect(elementTitle.hasClass(expandedClass)).ok() + .expect(elementTitle.hasClass(collapsedClass)).notOk(); await t.expect(await getQuestionState()).eql("expanded"); await t .click(elementTitle) - .expect(elementTitle.hasClass("sv_q_title_expandable")).ok() - .expect(elementTitle.hasClass("sv_q_title_collapsed")).ok() - .expect(elementTitle.hasClass("sv_q_title_expanded")).notOk(); + .expect(elementTitle.hasClass(expandableClass)).ok() + .expect(elementTitle.hasClass(collapsedClass)).ok() + .expect(elementTitle.hasClass(expandedClass)).notOk(); await t.expect(await getQuestionState()).eql("collapsed"); }); @@ -294,6 +297,7 @@ frameworks.forEach((framework) => { test("check adaptivity with one action", async (t) => { const json = { + widthMode: "responsive", questions: [ { name: "name", @@ -361,28 +365,25 @@ frameworks.forEach((framework) => { const myAction = Selector(".sv-action").nth(0); const myAction2 = Selector(".sv-action").nth(1); const dotsItem = Selector(".sv-action.sv-dots"); - + const titleClassName = ".sd-action__title"; await t .resizeWindow(600, 600) - .expect(myAction.find(".sv-action-bar-item__title").exists).ok() - .expect(myAction2.find(".sv-action-bar-item__title").exists).notOk() + .expect(myAction.find(titleClassName).exists).ok() + .expect(myAction2.find(titleClassName).exists).notOk() .expect(dotsItem.visible).notOk(); await ClientFunction(() => { window["survey"].getQuestionByName("name").getTitleToolbar().actions[0].title = "Act1.1 long title for adaptivity testing"; })(); await t - .expect(myAction.find(".sv-action-bar-item__title").exists).ok() - .expect(myAction2.find(".sv-action-bar-item__title").exists).notOk(); + .expect(myAction.find(titleClassName).exists).ok() + .expect(myAction2.find(titleClassName).exists).notOk(); }); }); -const themeName = "defaultV2"; - frameworks.forEach((framework) => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { - await applyTheme(themeName); + .page`${url}${framework}`.beforeEach(async (t) => { }); test("check hidden action content has non-zero width", async (t) => { await initSurvey(framework, json, { @@ -420,8 +421,7 @@ function addTitleActionForFocus(_, opt) { frameworks.forEach(async framework => { fixture`${framework} ${title}` - .page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { - await applyTheme(themeName); + .page`${url}${framework}`.beforeEach(async (t) => { }); test("Check Action focus", async t => { diff --git a/testCafe/survey/workWithData.js b/functionalTests/survey/workWithData.js similarity index 98% rename from testCafe/survey/workWithData.js rename to functionalTests/survey/workWithData.js index ff9f14f10d..0aedd20912 100644 --- a/testCafe/survey/workWithData.js +++ b/functionalTests/survey/workWithData.js @@ -88,7 +88,7 @@ frameworks.forEach(framework => { await add_value_changed_listener(); await t .expect(resultElement.exists).notOk() - .typeText(".sv_row input", "John Doe") + .typeText(".sd-row input", "John Doe") .pressKey("tab") .expect(resultElement.textContent).eql("John Doe") diff --git a/testCafe/validation/customValidators.js b/functionalTests/validation/customValidators.js similarity index 100% rename from testCafe/validation/customValidators.js rename to functionalTests/validation/customValidators.js diff --git a/testCafe/validation/focusErroredInput.js b/functionalTests/validation/focusErroredInput.js similarity index 100% rename from testCafe/validation/focusErroredInput.js rename to functionalTests/validation/focusErroredInput.js diff --git a/testCafe/validation/standardValidators.js b/functionalTests/validation/standardValidators.js similarity index 97% rename from testCafe/validation/standardValidators.js rename to functionalTests/validation/standardValidators.js index 47a0655bec..69a7bc87ed 100644 --- a/testCafe/validation/standardValidators.js +++ b/functionalTests/validation/standardValidators.js @@ -48,6 +48,7 @@ frameworks.forEach((framework) => { ); test("check validation", async (t) => { + await t.resizeWindow(1920, 1080); const getError = Selector((text, index) => { var nodes = []; document.querySelectorAll("*").forEach(function (node) { @@ -58,7 +59,7 @@ frameworks.forEach((framework) => { }); const getTextInputByIndex = Selector( - (index) => document.querySelectorAll(".sv_q_text_root")[index] + (index) => document.querySelectorAll(".sd-text")[index] ); const getTextarea = Selector(() => document.querySelector("textarea")); let surveyResult; diff --git a/testCafe/validation/validateOnEvent.js b/functionalTests/validation/validateOnEvent.js similarity index 100% rename from testCafe/validation/validateOnEvent.js rename to functionalTests/validation/validateOnEvent.js diff --git a/testCafe/validation/validateOnServer.js b/functionalTests/validation/validateOnServer.js similarity index 100% rename from testCafe/validation/validateOnServer.js rename to functionalTests/validation/validateOnServer.js diff --git a/package.json b/package.json index a1efca57c2..92924220e4 100644 --- a/package.json +++ b/package.json @@ -1,226 +1,32 @@ { "scripts": { - "start": "npm run build_dev && live-server --port=7777 --watch=build", - "serve": "live-server --port=7777 --watch=build", - "serve_ci": "http-server", - "test": "karma start ./build-scripts/karma.conf.js", - "testcafe": "testcafe testCafe/ --app \"http-server\" --selector-timeout 1500 --reporter minimal --config-file .testcaferc.dev.js", - "testcafe_file": "concurrently \"http-server --silent\" \"testcafe testCafe/survey/surveyWidth.ts --selector-timeout 1500 --reporter minimal --config-file .testcaferc.dev.js\"", - "testcafe_ci": "testcafe -c 4 -q chrome:headless testCafe/ --app \"http-server --silent\" --reporter minimal", - "testcafe_sauce": "testcafe \"saucelabs:Chrome@56.0:Windows 10\" testCafe/", - "testcafe:ko": "testcafe testCafe/ --app \"http-server --silent\" --reporter minimal --env=knockout", - "testcafe:jquery-ui": "testcafe testCafe/ --app \"http-server --silent\" --env=jquery-ui --config-file .testcaferc.dev.js", - "testcafe:jquery-ui:ci": "testcafe testCafe/ --app \"http-server --silent\" --reporter minimal --env=jquery-ui", - "testcafe:survey-js-ui": "testcafe testCafe/ --app \"http-server --silent\" --env=survey-js-ui --config-file .testcaferc.dev.js", - "testcafe:survey-js-ui:ci": "testcafe testCafe/ --app \"http-server --silent\" --reporter minimal --env=survey-js-ui", - "vrt:jquery-ui:ci": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=jquery-ui", - "vrt:survey-js-ui:ci": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=survey-js-ui", - "vrt:survey-js-ui": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=survey-js-ui --config-file .testcaferc.dev.js", - "testcafe:react": "testcafe testCafe/ --app \"http-server --silent\" --reporter minimal --env=react", - "testcafe:vue": "testcafe testCafe/ --app \"http-server --silent\" --reporter minimal --env=vue", - "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" ", - "build_core_dev": "webpack --config ./build-scripts/survey-core/webpack.config.js --env.buildType dev", - "build_core_prod": "webpack --config ./build-scripts/survey-core/webpack.config.js --env.buildType prod", - "build_knockout_dev": "webpack --config ./build-scripts/survey-knockout/webpack.config.js --env.buildType dev", - "build_knockout_prod": "webpack --config ./build-scripts/survey-knockout/webpack.config.js --env.buildType prod", - "build_react_dev": "webpack --config ./build-scripts/survey-react/webpack.config.js --env.buildType dev", - "build_react_prod": "webpack --config ./build-scripts/survey-react/webpack.config.js --env.buildType prod", - "build_vue_dev": "webpack --config ./build-scripts/survey-vue/webpack.config.js --env.buildType dev && webpack --config ./build-scripts/survey-vue/webpack.themes.config.js --env.buildType dev", - "build_vue_prod": "webpack --config ./build-scripts/survey-vue/webpack.config.js --env.buildType prod && webpack --config ./build-scripts/survey-vue/webpack.themes.config.js --env.buildType prod", - "build_jquery_dev": "webpack --config ./build-scripts/survey-jquery/webpack.config.js --env.buildType dev && webpack --config ./build-scripts/survey-jquery/webpack.themes.config.js --env.buildType dev", - "build_jquery_prod": "webpack --config ./build-scripts/survey-jquery/webpack.config.js --env.buildType prod && webpack --config ./build-scripts/survey-jquery/webpack.themes.config.js --env.buildType prod", - "build_jquery_ui_dev": "webpack --config ./build-scripts/survey-jquery-ui/webpack.config.js --env.buildType dev", - "build_jquery_ui_prod": "webpack --config ./build-scripts/survey-jquery-ui/webpack.config.js --env.buildType prod", - "build_js_ui_dev": "webpack --config ./build-scripts/survey-js-ui/webpack.config.js --env.buildType dev", - "build_js_ui_prod": "webpack --config ./build-scripts/survey-js-ui/webpack.config.js --env.buildType prod", - "build_angular_dev": "webpack --config ./build-scripts/survey-angular/webpack.config.js --env.buildType dev", - "build_angular_prod": "webpack --config ./build-scripts/survey-angular/webpack.config.js --env.buildType prod", - "build_i18n_dev": "webpack --config ./build-scripts/survey-core/webpack.i18n.js --env.buildType dev", - "build_i18n_prod": "webpack --config ./build-scripts/survey-core/webpack.i18n.js --env.buildType prod", - "build_dev": "concurrently \"npm run build_knockout_dev\" \"npm run build_react_dev\" \"npm run build_angular_dev\" \"npm run build_jquery_dev\" \"npm run build_vue_dev\" \"npm run build_core_dev\" \"npm run build_i18n_dev\"", - "build_prod": "npm run build_dev && concurrently \"npm run build_knockout_prod\" \"npm run build_react_prod\" \"npm run build_angular_prod\" \"npm run build_jquery_prod\" \"npm run build_vue_prod\" \"npm run build_core_prod\" \"npm run build_i18n_prod\"", - "build": "npm run build_prod && concurrently \"npm run build_knockout_ui_dev && npm run build_knockout_ui_prod\" \"npm run build_react_ui\"", - "doc_gen": "node doc_generator/lib_docgenerator.js src/entries/chunks/model.ts", - "doc_update": "chmod +x ./docupdate_npm.sh && ./docupdate_npm.sh", - "watch_knockout_dev": "webpack --config ./build-scripts/survey-knockout/webpack.config.js --env.buildType dev --watch", - "watch_react_dev": "webpack --config ./build-scripts/survey-react/webpack.config.js --env.buildType dev --watch", - "watch_angular_dev": "webpack --config ./build-scripts/survey-angular/webpack.config.js --env.buildType dev --watch", - "watch_jquery_dev": "webpack --config ./build-scripts/survey-jquery/webpack.config.js --env.buildType dev --watch", - "watch_vue_dev": "webpack --config ./build-scripts/survey-vue/webpack.config.js --env.buildType dev --watch", - "build_knockout": "npm run build_knockout_dev && npm run build_knockout_prod && rimraf build/survey-knockout/ts3.4 && downlevel-dts build/survey-knockout build/survey-knockout/ts3.4", - "build_knockout_ui_dev": "webpack --config ./build-scripts/survey-knockout-ui/webpack.config.js --env.buildType dev", - "build_knockout_ui_prod": "webpack --config ./build-scripts/survey-knockout-ui/webpack.config.js --env.buildType prod", - "build_knockout_ui": "npm run build_knockout_ui_dev && npm run build_knockout_ui_prod && rimraf build/survey-knockout-ui/ts3.4 && downlevel-dts build/survey-knockout-ui build/survey-knockout-ui/ts3.4", - "build_react": "npm run build_react_dev && npm run build_react_prod", - "build_react_ui": "webpack --config ./build-scripts/survey-react-ui/webpack.config.js --env.buildType dev && webpack --config ./build-scripts/survey-react-ui/webpack.config.js --env.buildType prod", - "build_vue": "npm run build_vue_dev && npm run build_vue_prod", - "build_vue_ui": "webpack --config ./build-scripts/survey-vue-ui/webpack.config.js --env.buildType dev && webpack --config ./build-scripts/survey-vue-ui/webpack.config.js --env.buildType prod", - "build_core": "npm run build_core_dev && npm run build_core_prod && npm run build-themes && npm run build-icons && rimraf build/survey-core/ts3.4 && downlevel-dts build/survey-core build/survey-core/ts3.4", - "build-plugins": "npm run build-plugins-dev && npm run build-plugins-prod", - "build-plugins-dev": "concurrently \"webpack --config ./build-scripts/survey-core/webpack.plugins.bootstrap.config.js --env.buildType dev\" \"webpack --config ./build-scripts/survey-core/webpack.plugins.bootstrap.material.config.js --env.buildType dev\"", - "build-plugins-prod": "concurrently \"webpack --config ./build-scripts/survey-core/webpack.plugins.bootstrap.config.js --env.buildType prod\" \"webpack --config ./build-scripts/survey-core/webpack.plugins.bootstrap.material.config.js --env.buildType prod\"", - "build-themes": "npm run build-themes-dev && npm run build-themes-prod", - "build-themes-dev": "webpack --config ./build-scripts/survey-core/webpack.themes.config.js --env.buildType dev", - "build-themes-prod": "webpack --config ./build-scripts/survey-core/webpack.themes.config.js --env.buildType prod", - "build-icons": "npm run build-icons-dev && npm run build-icons-prod", - "build-icons-dev": "webpack --config ./build-scripts/survey-core/webpack.icons.config.js --env.buildType dev", - "build-icons-prod": "webpack --config ./build-scripts/survey-core/webpack.icons.config.js --env.buildType prod", - "build_i18n": "npm run build_i18n_dev && npm run build_i18n_prod", - "build_jquery": "npm run build_jquery_dev && npm run build_jquery_prod", - "build_jquery_ui": "npm run build_jquery_ui_dev && npm run build_jquery_ui_prod", - "build_js_ui": "npm run build_js_ui_dev && npm run build_js_ui_prod", - "build_angular": "npm run build_angular_dev && npm run build_angular_prod && rimraf build/survey-angular/ts3.4 && downlevel-dts build/survey-angular build/survey-angular/ts3.4", - "watch:core:dev": "webpack --config ./build-scripts/survey-core/webpack.config.js --env.buildType dev --watch", - "watch:core:prod": "webpack --config ./build-scripts/survey-core/webpack.config.js --env.buildType prod --watch", - "watch:ko:ui:dev": "webpack --config ./build-scripts/survey-knockout-ui/webpack.config.js --env.buildType dev --watch", - "watch:react:ui:dev": "webpack --config ./build-scripts/survey-react-ui/webpack.config.js --env.buildType dev --watch", - "watch:ko:ui:prod": "webpack --config ./build-scripts/survey-knockout-ui/webpack.config.js --env.buildType prod --watch", - "watch:react:ui:prod": "webpack --config ./build-scripts/survey-react-ui/webpack.config.js --env.buildType prod --watch", - "dev": "concurrently \"http-server -p 7766 --silent\" \"npm run watch:core:dev\" \"npm run watch:core:prod\" \"npm run watch:ko:ui:dev\" \"npm run watch:react:ui:dev\" \"npm run watch:ko:ui:prod\" \"npm run watch:react:ui:prod\"", - "madge": "madge --circular --extensions ts ./src/", - "pre-push-check": "npm run lint && npm run testsingle", - "lint": "eslint ./src --quiet && eslint ./testCafe --quiet && eslint ./tests --quiet && eslint ./visualRegressionTests --quiet && eslint ./accessibilityTests --quiet", - "testsingle": "karma start ./build-scripts/karma.conf.js --single-run", - "test:knockout": "karma start ./build-scripts/survey-knockout/karma.conf.knockout.js", - "test:react": "karma start ./build-scripts/survey-react/karma.conf.react.js", - "test:vue": "karma start ./build-scripts/survey-vue/karma.conf.vue.js", - "test:knockout:single": "karma start ./build-scripts/survey-knockout/karma.conf.knockout.js --single-run", - "test:react:single": "karma start ./build-scripts/survey-react/karma.conf.react.js --single-run", - "test:vue:single": "karma start ./build-scripts/survey-vue/karma.conf.vue.js --single-run", - "test:markup": "npm run test:knockout:single && npm run test:react:single && npm run test:vue:single", - "visual-regression-tests": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --reporter minimal --selector-timeout 1500 --config-file .testcaferc.dev.js", - "vrt:ko": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --reporter minimal --env=knockout --selector-timeout 1500 --config-file .testcaferc.dev.js", - "vrt:react": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --reporter minimal --env=react --selector-timeout 1500 --config-file .testcaferc.dev.js", - "visual-regression-tests:ci": "testcafe chrome:headless ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal", - "visual-regression-tests:ci:knockout": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --env=knockout --reporter minimal", - "visual-regression-tests:ci:angular": "testcafe ./visualRegressionTests/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=angular", - "visual-regression-tests:angular": "testcafe ./visualRegressionTests/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=angular --config-file .testcaferc.dev.js", - "visual-regression-tests:ci:react": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=react", - "visual-regression-tests:ci:vue": "testcafe ./visualRegressionTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=vue", - "visual-regression-tests:file": "testcafe chrome:headless --app \"http-server\" ./visualRegressionTests/tests/defaultV2/paneldynamic.ts --screenshots ./ --reporter minimal --selector-timeout 1500", - "visual-regression-tests:ci:vue3": "testcafe ./visualRegressionTests/ --app \"npm run preview --prefix ./packages/survey-vue3-ui/example\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=vue3", - "visual-regression-tests:vue3": "testcafe ./visualRegressionTests/ --app \"npm run preview --prefix ./packages/survey-vue3-ui/example\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=vue3 --config-file .testcaferc.dev.js", - "accessibility-tests": "testcafe ./accessibilityTests/ --app \"http-server\" --screenshots ./ --reporter minimal --selector-timeout 1500 --config-file .testcaferc.dev.js", - "accessibility-tests:ci:knockout": "testcafe ./accessibilityTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=knockout", - "accessibility-tests:ci:angular": "testcafe ./accessibilityTests/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=angular", - "accessibility-tests:ci:react": "testcafe ./accessibilityTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=react", - "accessibility-tests:ci:vue": "testcafe ./accessibilityTests/ --app \"http-server\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=vue", - "accessibility-tests:ci:vue3": "testcafe ./accessibilityTests/ --app \"npm run preview --prefix ./packages/survey-vue3-ui/example\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=vue3", - "testcafe:ci:vue3": "testcafe testCafe/ --app \"npm run preview --prefix ./packages/survey-vue3-ui/example\" --selector-timeout 1500 --reporter minimal --env=vue3", - "testcafe:vue3": "testcafe testCafe/ --app \"npm run preview --prefix ./packages/survey-vue3-ui/example \" --selector-timeout 1500 --reporter minimal --env=vue3 --config-file .testcaferc.dev.js", - "testcafe:angular": "testcafe testCafe/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --selector-timeout 1500 --reporter minimal --env=angular --config-file .testcaferc.dev.js", - "testcafe:ci:angular": "testcafe testCafe/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --selector-timeout 1500 --reporter minimal --env=angular", - "prepare": "husky install", - "test:postcss": "postcss build/survey-core/defaultV2.css --silent -u postcss-calc -u autoprefixer -u postcss-fail-on-warn -o defaultV2.postcss.css && rimraf defaultV2.postcss.css" + "lint": "eslint ./functionalTests --quiet && eslint ./tests --quiet && eslint ./visualRegressionTests --quiet && eslint ./accessibilityTests --quiet", + "pre-push-check": "npm run lint", + "prepare": "husky install" }, - "version": "1.12.16", + "version": "1.12.17", "name": "survey-library", "private": true, "devDependencies": { "@babel/plugin-transform-runtime": "7.23.3", - "@playwright/test": "^1.48.2", - "@types/ace": "0.0.32", - "@types/angular": "^1.6.2", - "@types/babel__traverse": "7.18.2", - "@types/jest": "23.3.3", - "@types/jquery": "^2.0.39", - "@types/lodash": "4.14.186", - "@types/node": "* <=18.11.12", - "@types/papaparse": "^5.0.4", - "@types/qunit": "2.0.31", - "@types/react": "^17.0.83", - "@types/react-dom": "^17.0.1", - "@types/signature_pad": "^2.3.0", - "@typescript-eslint/eslint-plugin": "^4.29.0", - "@typescript-eslint/parser": "^4.29.0", - "@vue/eslint-config-typescript": "^11.0.0", - "ace-builds": "1.2.2", - "ajv": "6.12.3", - "autoprefixer": "^10.4.17", - "axe-core": "^4.8.2", - "axe-testcafe": "^3.0.0", - "babel-loader": "8.2.5", - "colors": "1.4.0", - "commit-and-tag-version": "^11.0.0", - "concurrently": "^5.2.0", - "copy-webpack-plugin": "4.0.1", - "css-loader": "^3.6.0", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "@typescript-eslint/parser": "^5.41.0", + "concurrently": "^7", "devextreme-screenshot-comparer": "^2.0.11", - "dotenv": "4.0.0", - "downlevel-dts": "~0.11.0", "eslint": "^7.32.0", "eslint-cli": "^1.1.1", - "eslint-plugin-react": "7.30.1", "eslint-plugin-surveyjs": "file:eslint-surveyjs", - "eslint-plugin-vue": "^9.3.0", - "file-loader": "0.10.0", - "generate-json-webpack-plugin": "^1.0.0", + "eslint-plugin-react": "^7.25.1", + "husky": "^7.0.4", + "node-uuid": "1.4.7", + "testcafe": "3.3.0", "get-func-name": "2.0.0", - "github-api": "^3.3.0", - "html-loader": "0.4.4", - "http-server": "^0.12.3", - "husky": "^8", - "jest": "^26.1.0", - "jest-canvas-mock": "^2.2.0", - "jquery": "^3.5.1", - "karma": "^6.1.1", - "karma-chrome-launcher": "^3.1.0", - "karma-junit-reporter": "2.0.1", - "karma-qunit": "4.1.2", - "karma-sourcemap-loader": "0.3.8", - "karma-webpack": "5.0.0", - "knockout": "^3.5.0", - "live-server": "1.2.1", - "madge": "^4.0.2", - "mini-css-extract-plugin": "^0.9.0", - "minimist": "^1.2.5", - "node-uuid": "^1.4.8", - "postcss": "8.4.31", - "postcss-calc": "9.0.1", - "postcss-cli": "10.1.0", - "postcss-fail-on-warn": "0.2.1", - "preact": "^10.21.0", + "@types/lodash": "4.14.186", "puppeteer": "22.13.1", - "qunit": "2.14.0", - "react": "17.0.1", - "react-dom": "17.0.1", - "replace-in-file": "^3.4.3", - "rimraf": "2.5.4", - "sass": "^1", - "sass-loader": "^8.0.2", - "style-loader": "^1.2.1", - "surveyjs-doc-generator": "git+https://github.com/surveyjs/surveyjs-doc-generator.git", - "svg-inline-loader": "^0.8.2", - "testcafe": "3.3.0", - "testcafe-reporter-junit": "^3.0.2", - "ts-jest": "^26.1.1", - "ts-loader": "^8.0.15", - "ts-node": "3.3.0", - "tsconfig-paths-webpack-plugin": "^3.3.0", - "typescript": "~4.2.2", - "url-loader": "0.5.8", - "val-loader": "0.5.0", - "vue": "2.6.14", - "vue-class-component": "7.2.6", - "vue-class-decorator": "7.6.3", - "vue-loader": "15.9.8", - "vue-property-decorator": "9.1.2", - "vue-template-compiler": "2.6.14", - "vue-tsc": "1.0.8", - "webpack": "^4.43.0", - "webpack-cli": "^3.3.12", - "webpack-dev-server": "^3.11.0", - "webpack-fix-style-only-entries": "^0.6.1", - "webpack-merge": "^5.7.3", - "webpack-svgstore-plugin": "4.0.1" + "axe-core": "^4.8.2", + "axe-testcafe": "^3.0.0" }, "overrides": { - "karma-webpack": { - "webpack": "^4.43.0" - }, - "downlevel-dts": { - "typescript": "5.1.6" - }, "axe-testcafe": { "axe-core": "^4.8.2" } @@ -229,9 +35,5 @@ "hooks": { "pre-push": "npm run pre-push-check" } - }, - "dependencies": { - "signature_pad": "^4.1.5", - "vite": "^3.1.8" } -} +} \ No newline at end of file diff --git a/packages/survey-angular-ui/CHANGELOG.md b/packages/survey-angular-ui/CHANGELOG.md index 0f401f8283..4039cef214 100644 --- a/packages/survey-angular-ui/CHANGELOG.md +++ b/packages/survey-angular-ui/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.12.17](https://github.com/surveyjs/surveyjs/compare/v1.12.16...v1.12.17) (2024-12-30) + ## [1.12.16](https://github.com/surveyjs/surveyjs/compare/v1.12.15...v1.12.16) (2024-12-24) ## [1.12.15](https://github.com/surveyjs/surveyjs/compare/v1.12.14...v1.12.15) (2024-12-17) diff --git a/packages/survey-angular-ui/example/package.json b/packages/survey-angular-ui/example/package.json index d8f353796c..61c04aee2f 100644 --- a/packages/survey-angular-ui/example/package.json +++ b/packages/survey-angular-ui/example/package.json @@ -4,8 +4,7 @@ "peerDependencies": {}, "devDependencies": {}, "dependencies": { - "bootstrap": "^3.3.7", - "survey-core": "../../../build/survey-core", + "survey-core": "../../survey-core/build", "surveyjs-widgets": "^1.9.40", "tslib": "^2.3.0" } diff --git a/packages/survey-angular-ui/example/src/app/app.module.ts b/packages/survey-angular-ui/example/src/app/app.module.ts index eb6af6dfc4..87bcdb9631 100644 --- a/packages/survey-angular-ui/example/src/app/app.module.ts +++ b/packages/survey-angular-ui/example/src/app/app.module.ts @@ -9,17 +9,14 @@ import { ExampleComponent } from "./components/example/example.component"; import { AppRoutingModule } from "./router.module"; import { AngularItemTemplateComponent } from "./components/itemTemplateComponent"; import { AngularItemContentTemplateComponent } from "./components/itemContentTemplateComponent"; -import { TestDefaultComponent } from "./components/test/testdefault.component"; import { TestDefaultV2Component } from "./components/test/testdefaultV2.component"; -import { TestModernComponent } from "./components/test/testmodern.component"; -import { TestBootstrapComponent } from "./components/test/bootstrap.component"; import { TestCustomWidgetComponent } from "./components/test/customwidget.component"; import { CustomActionComponent } from "./components/test-custom-components/action-custom.component"; import { EmptyComponent } from "./components/test/empty.component"; @NgModule({ declarations: [ - AppComponent, ExampleComponent, TestComponent, TestDefaultComponent, TestDefaultV2Component, TestModernComponent, TestBootstrapComponent, + AppComponent, ExampleComponent, TestComponent, TestDefaultV2Component, TestCustomWidgetComponent, AngularItemTemplateComponent, AngularItemContentTemplateComponent, diff --git a/packages/survey-angular-ui/example/src/app/components/example/example.component.ts b/packages/survey-angular-ui/example/src/app/components/example/example.component.ts index e6bc907df6..eecc1f9efd 100644 --- a/packages/survey-angular-ui/example/src/app/components/example/example.component.ts +++ b/packages/survey-angular-ui/example/src/app/components/example/example.component.ts @@ -1,5 +1,5 @@ import { Component, ViewEncapsulation } from "@angular/core"; -import { SurveyModel, StylesManager } from "survey-core"; +import { SurveyModel } from "survey-core"; const json = require("../../../assets/survey.json"); @Component({ diff --git a/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.scss b/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.scss deleted file mode 100644 index 48ca37b43d..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import "bootstrap/dist/css/bootstrap.css" \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.ts b/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.ts deleted file mode 100644 index fcd97b18c8..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/bootstrap.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; -import { StylesManager } from "survey-core"; -import { TestComponent } from "./test.component"; -import "survey-core/plugins/bootstrap-integration"; - -@Component({ - selector: "test-bootstap", - templateUrl: "./test.component.html", - styleUrls: ["./bootstrap.component.scss"], - encapsulation: ViewEncapsulation.None -}) -export class TestBootstrapComponent extends TestComponent { - constructor(changeDetectorRef: ChangeDetectorRef) { - super(changeDetectorRef); - StylesManager.applyTheme("bootstrap"); - } -} \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.scss b/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.scss index 8a128dd9c9..d19b43b3a9 100644 --- a/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.scss +++ b/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.scss @@ -1,3 +1,2 @@ @import "icheck/skins/flat/green.css"; -@import "icheck/skins/square/blue.css"; -@import "survey-core/survey.css" \ No newline at end of file +@import "icheck/skins/square/blue.css"; \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.ts b/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.ts index 86e3c0ae34..fb78aa7e4f 100644 --- a/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.ts +++ b/packages/survey-angular-ui/example/src/app/components/test/customwidget.component.ts @@ -1,5 +1,4 @@ -import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; -import { StylesManager } from "survey-core"; +import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; import * as SurveyCore from "survey-core"; import { TestComponent } from "./test.component"; import * as widgets from "surveyjs-widgets"; @@ -13,7 +12,6 @@ import "icheck"; export class TestCustomWidgetComponent extends TestComponent { constructor(changeDetectorRef: ChangeDetectorRef) { super(changeDetectorRef); - StylesManager.applyTheme("default"); widgets.sortablejs(SurveyCore); widgets.icheck(SurveyCore, (window).jQuery); } diff --git a/packages/survey-angular-ui/example/src/app/components/test/empty.component.ts b/packages/survey-angular-ui/example/src/app/components/test/empty.component.ts index 9c04408804..a596a99b69 100644 --- a/packages/survey-angular-ui/example/src/app/components/test/empty.component.ts +++ b/packages/survey-angular-ui/example/src/app/components/test/empty.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component } from "@angular/core"; +import { Component } from "@angular/core"; @Component({ selector: "empty", diff --git a/packages/survey-angular-ui/example/src/app/components/test/test.component.ts b/packages/survey-angular-ui/example/src/app/components/test/test.component.ts index 8bf32a19a3..dfca39076a 100644 --- a/packages/survey-angular-ui/example/src/app/components/test/test.component.ts +++ b/packages/survey-angular-ui/example/src/app/components/test/test.component.ts @@ -1,7 +1,6 @@ import { ChangeDetectorRef, Component } from "@angular/core"; import { SurveyModel } from "survey-core"; import * as Survey from "survey-core"; -import { defaultCss } from "survey-core/plugins/bootstrap-integration"; import "survey-core/survey.i18n"; @Component({ @@ -14,14 +13,11 @@ export class TestComponent { public isExpanded: boolean = true; constructor(private changeDetectorRef: ChangeDetectorRef) { (window as any).Survey = Survey; - Survey.defaultStandardCss.variables.mobileWidth = undefined; - Survey.modernCss.variables.mobileWidth = undefined; (window).setSurvey = (survey: SurveyModel | Survey.PopupSurveyModel, isPopup: boolean, isExpanded: boolean = true) => { this.model = survey; this.isPopup = isPopup; this.isExpanded = isExpanded; this.changeDetectorRef.detectChanges(); }; - (window as any).Survey.defaultBootstrapCss = defaultCss; } } diff --git a/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.scss b/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.scss deleted file mode 100644 index bafb8f21f4..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import "survey-core/survey.css" \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.ts b/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.ts deleted file mode 100644 index 2921aed073..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/testdefault.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; -import { StylesManager } from "survey-core"; -import { TestComponent } from "./test.component"; - -@Component({ - selector: "test-default", - templateUrl: "./test.component.html", - styleUrls: ["./testdefault.component.scss"], - encapsulation: ViewEncapsulation.None -}) -export class TestDefaultComponent extends TestComponent { - constructor(changeDetectorRef: ChangeDetectorRef) { - super(changeDetectorRef); - StylesManager.applyTheme("default"); - } -} \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/testdefaultV2.component.ts b/packages/survey-angular-ui/example/src/app/components/test/testdefaultV2.component.ts index 44c776550b..3e3f36e4b3 100644 --- a/packages/survey-angular-ui/example/src/app/components/test/testdefaultV2.component.ts +++ b/packages/survey-angular-ui/example/src/app/components/test/testdefaultV2.component.ts @@ -1,5 +1,4 @@ import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; -import { StylesManager } from "survey-core"; import { TestComponent } from "./test.component"; @Component({ @@ -11,6 +10,5 @@ import { TestComponent } from "./test.component"; export class TestDefaultV2Component extends TestComponent { constructor(changeDetectorRef: ChangeDetectorRef) { super(changeDetectorRef); - StylesManager.applyTheme("defaultV2"); } } \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.scss b/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.scss deleted file mode 100644 index 4f59fd7afa..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import "survey-core/modern.css"; \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.ts b/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.ts deleted file mode 100644 index ddf936e834..0000000000 --- a/packages/survey-angular-ui/example/src/app/components/test/testmodern.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ChangeDetectorRef, Component, ViewEncapsulation } from "@angular/core"; -import { StylesManager } from "survey-core"; -import { TestComponent } from "./test.component"; -@Component({ - selector: "test-modern", - templateUrl: "./test.component.html", - styleUrls: ["./testmodern.component.scss"], - encapsulation: ViewEncapsulation.None -}) -export class TestModernComponent extends TestComponent { - constructor(changeDetectorRef: ChangeDetectorRef) { - super(changeDetectorRef); - StylesManager.applyTheme("modern"); - } -} \ No newline at end of file diff --git a/packages/survey-angular-ui/example/src/app/router.module.ts b/packages/survey-angular-ui/example/src/app/router.module.ts index 79b5ea2680..a8f5fdb644 100644 --- a/packages/survey-angular-ui/example/src/app/router.module.ts +++ b/packages/survey-angular-ui/example/src/app/router.module.ts @@ -1,21 +1,12 @@ import { NgModule } from "@angular/core"; import { RouterModule } from "@angular/router"; -import { TestBootstrapComponent } from "./components/test/bootstrap.component"; import { TestCustomWidgetComponent } from "./components/test//customwidget.component"; -import { TestDefaultComponent } from "./components/test//testdefault.component"; import { TestDefaultV2Component } from "./components/test/testdefaultV2.component"; -import { TestModernComponent } from "./components/test/testmodern.component"; import { EmptyComponent } from "./components/test/empty.component"; const routes = [ - { path: "examples_test/default/angular", component: TestDefaultComponent }, - { path: "examples_test/default/angular.html", component: TestDefaultComponent }, { path: "examples_test/defaultV2/angular", component: TestDefaultV2Component }, { path: "examples_test/defaultV2/angular.html", component: TestDefaultV2Component }, - { path: "examples_test/modern/angular", component: TestModernComponent }, - { path: "examples_test/modern/angular.html", component: TestModernComponent }, - { path: "examples_test/bootstrap/angular", component: TestBootstrapComponent }, - { path: "examples_test/bootstrap/angular.html", component: TestBootstrapComponent }, { path: "examples_test/customWidget/angular", component: TestCustomWidgetComponent }, { path: "examples_test/customWidget/angular.html", component: TestCustomWidgetComponent }, { path: "test", component: EmptyComponent } diff --git a/packages/survey-angular-ui/package.json b/packages/survey-angular-ui/package.json index 52d85d44e8..d8c730eb58 100644 --- a/packages/survey-angular-ui/package.json +++ b/packages/survey-angular-ui/package.json @@ -1,6 +1,6 @@ { "name": "survey-angular-ui", - "version": "1.12.16", + "version": "2.0.0", "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", "keywords": [ "Survey", @@ -43,6 +43,7 @@ "@babel/traverse": "7.25.9", "jasmine-core": "~3.8.0", "karma": "~6.3.0", + "karma-webpack": "5.0.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-jasmine": "~4.0.0", @@ -55,15 +56,22 @@ "rxjs": "~6.6.0", "tslib": "^2.3.0", "zone.js": "~0.11.4", - "copyfiles": "~2.4.1", - "survey-core": "../../build/survey-core" + "survey-core": "../survey-core/build", + "http-server": "^14.1.1" }, "scripts": { - "build": "ng build && npx copyfiles -u 1 \"build/**/*\" ../../build/survey-angular-ui && node ./update-version.js", - "serve:example": "ng serve", - "build:example": "ng build --aot --output-hashing=none angular-ui", - "test": "ng test survey-angular-ui", - "test:single": "ng test --watch=false --browsers=ChromeHeadless survey-angular-ui", - "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" " + "build": "ng build && node ./update-version.js", + "serve:example:dev": "ng serve", + "serve:example:prod": "http-server ./example/dist --proxy http://localhost:8080? -p 8080", + "build:example:prod": "ng build --aot --output-hashing=none angular-ui", + "test": "ng test --watch=false --browsers=ChromeHeadless survey-angular-ui", + "test:watch": "ng test survey-angular-ui", + "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" ", + "testcafe": "testcafe ../../functionalTests/ --app \"npm run serve:example:prod\" --selector-timeout 1500 --reporter minimal --env=angular --config-file ../../.testcaferc.dev.js", + "testcafe:ci": "testcafe ../../functionalTests/ --app \"npm run serve:example:prod\" --selector-timeout 1500 --reporter minimal --env=angular --config-file ../../.testcaferc.js", + "vrt": "testcafe ../../visualRegressionTests/ --app \"npm run serve:example:prod\" --screenshots ../../ --selector-timeout 1500 --reporter minimal --env=angular --config-file ../../.testcaferc.dev.js", + "vrt:ci": "testcafe ../../visualRegressionTests/ --app \"npm run serve:example:prod\" --screenshots ../../ --selector-timeout 1500 --reporter minimal --env=angular --config-file ../../.testcaferc.js", + "accessibility-tests:": "testcafe ../../accessibilityTests/ --app \"npm run serve:example:prod\" --screenshots ./ --selector-timeout 1500 --env=angular --config-file ../../.testcaferc.dev.js", + "accessibility-tests:ci": "testcafe ../../accessibilityTests/ --app \"npm run serve:example:prod\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=angular --config-file ../../.testcaferc.js" } -} +} \ No newline at end of file diff --git a/packages/survey-angular-ui/src/components/renderAs/dropdown-select/dropdown-select.component.html b/packages/survey-angular-ui/src/components/renderAs/dropdown-select/dropdown-select.component.html index a25956e7b2..ad7bc29382 100644 --- a/packages/survey-angular-ui/src/components/renderAs/dropdown-select/dropdown-select.component.html +++ b/packages/survey-angular-ui/src/components/renderAs/dropdown-select/dropdown-select.component.html @@ -6,11 +6,14 @@ [attr.aria-required]="model.ariaRequired" [attr.aria-label]="model.ariaLabel" [attr.aria-invalid]="model.ariaInvalid" [attr.aria-errormessage]="model.ariaErrormessage"> - + -
{{ model.readOnlyText }}
-
- +
{{ + model.readOnlyText }}
+
- + diff --git a/packages/survey-angular-ui/test/events.spec.ts b/packages/survey-angular-ui/test/events.spec.ts index 87fcf2ffd9..11c353d71e 100644 --- a/packages/survey-angular-ui/test/events.spec.ts +++ b/packages/survey-angular-ui/test/events.spec.ts @@ -1,11 +1,10 @@ import { TestBed } from "@angular/core/testing"; import { SurveyModule } from "src/angular-ui.module"; import { SurveyComponent } from "src/survey.component"; -import { SurveyModel, StylesManager } from "survey-core"; +import { SurveyModel } from "survey-core"; describe("event tests", () => { beforeEach(async () => { - StylesManager.applyTheme("default"); await TestBed.configureTestingModule({ imports: [SurveyModule], }).compileComponents(); @@ -46,9 +45,11 @@ describe("event tests", () => { it("Check that that survey after render header is called correctly", (done: any) => { const fixture = TestBed.createComponent(SurveyComponent); const component = fixture.componentInstance; - component.model = new SurveyModel({ title: "Some title", elements: [{ type: "text", name: "q1" }] }); + const survey = new SurveyModel({ title: "Some title", elements: [{ type: "text", name: "q1" }] }); + survey.css = { header: "sv_header" }; + component.model = survey; component.model.onAfterRenderHeader.add((sender: SurveyModel, opt: any) => { - expect(opt.htmlElement.className).toBe("sv_header"); + expect(opt.htmlElement.className.search(/sv_header/) > -1).toBe(true); done(); }); fixture.detectChanges(); @@ -56,7 +57,9 @@ describe("event tests", () => { it("Check that that question after question content is called correctly", (done: any) => { const fixture = TestBed.createComponent(SurveyComponent); const component = fixture.componentInstance; - component.model = new SurveyModel({ elements: [{ type: "text", name: "q1" }] }); + const survey = new SurveyModel({ elements: [{ type: "text", name: "q1" }] }); + survey.css = { text: { root: "sv_q_text_root" } }; + component.model =survey; component.model.onAfterRenderQuestionInput.add((sender: SurveyModel, opt: any) => { expect(opt.htmlElement.className.search(/sv_q_text_root/) > -1).toBe(true); done(); @@ -66,10 +69,12 @@ describe("event tests", () => { it("Check that after render page is called correctly", (done: any) => { const fixture = TestBed.createComponent(SurveyComponent); const component = fixture.componentInstance; - component.model = new SurveyModel({ pages: [{ elements: [{ type: "text", name: "q1" }] }, { elements: [{ type: "text", name: "q2" }] }] }); + const survey = new SurveyModel({ pages: [{ elements: [{ type: "text", name: "q1" }] }, { elements: [{ type: "text", name: "q2" }] }] }); + component.model = survey; let callCount = 0; + survey.css = { page: { root: "sv_p_root" } }; component.model.onAfterRenderPage.add((sender: SurveyModel, opt: any) => { - expect(opt.htmlElement.className).toBe("sv_p_root"); + expect(opt.htmlElement.className.search(/sv_p_root/) > -1).toBe(true); callCount++; }); fixture.autoDetectChanges(true); @@ -82,7 +87,7 @@ describe("event tests", () => { it("Check that after render panel is called correctly", (done: any) => { const fixture = TestBed.createComponent(SurveyComponent); const component = fixture.componentInstance; - component.model = new SurveyModel({ elements: [{ + const survey = new SurveyModel({ elements: [{ "type": "panel", "name": "panel1", "elements": [ @@ -92,8 +97,10 @@ describe("event tests", () => { } ] }] }); + survey.css = { panel: { container: "sv_p_container" } }; + component.model = survey; component.model.onAfterRenderPanel.add((sender: SurveyModel, opt: any) => { - expect(opt.htmlElement.className).toBe("sv_p_container"); + expect(opt.htmlElement.className.search(/sv_p_container/) > -1).toBe(true); done(); }); fixture.detectChanges(); diff --git a/packages/survey-angular-ui/test/markup/test.spec.ts b/packages/survey-angular-ui/test/markup/test.spec.ts index f8fdf65a9a..8791049798 100644 --- a/packages/survey-angular-ui/test/markup/test.spec.ts +++ b/packages/survey-angular-ui/test/markup/test.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from "@angular/core/testing"; import { SurveyComponent } from "src/survey.component"; -import { settings, StylesManager, SurveyModel } from "survey-core"; +import { settings, SurveyModel } from "survey-core"; import { testQuestionMarkup } from "../../../../tests/markup/helper"; import { markupTests } from "../../../../tests/markup/etalon"; import { SurveyModule } from "src/angular-ui.module"; @@ -19,9 +19,6 @@ const platformDescriptor = { getSettings: () => { return settings; }, - getStylesManager: () => { - return StylesManager; - } }; class ExpectAssertAdapter { diff --git a/packages/survey-angular-ui/tsconfig.app.json b/packages/survey-angular-ui/tsconfig.app.json index ea819787e2..d67496b597 100644 --- a/packages/survey-angular-ui/tsconfig.app.json +++ b/packages/survey-angular-ui/tsconfig.app.json @@ -10,7 +10,7 @@ ], "paths": { "survey-core": [ - "../../build/survey-core" + "./node_modules/survey-core" ], "survey-angular-ui": [ "./build" diff --git a/packages/survey-angular-ui/update-version.js b/packages/survey-angular-ui/update-version.js index 3e88c9cc0c..05c42fac18 100644 --- a/packages/survey-angular-ui/update-version.js +++ b/packages/survey-angular-ui/update-version.js @@ -1,5 +1,5 @@ const fs = require("fs"); -const jsonPath = `${__dirname}/../../build/survey-angular-ui/package.json`; +const jsonPath = `${__dirname}/build/package.json`; const json = JSON.parse(fs.readFileSync(jsonPath, "utf8")); json["peerDependencies"]["survey-core"] = json.version; fs.writeFileSync(jsonPath, JSON.stringify(json, undefined, 2)); diff --git a/doc_generator/lib_docgenerator.js b/packages/survey-core/doc_generator/lib_docgenerator.js similarity index 82% rename from doc_generator/lib_docgenerator.js rename to packages/survey-core/doc_generator/lib_docgenerator.js index 85a3b35ab2..0f4dbbf04a 100644 --- a/doc_generator/lib_docgenerator.js +++ b/packages/survey-core/doc_generator/lib_docgenerator.js @@ -1,6 +1,6 @@ var doc = require("surveyjs-doc-generator"); var ts = require("typescript"); -var Survey = require("../build/survey-core/survey.core"); +var Survey = require("../build/survey.core"); doc.setJsonObj(Survey.Serializer); diff --git a/docs/Question/visibleIf.md b/packages/survey-core/docs/Question/visibleIf.md similarity index 100% rename from docs/Question/visibleIf.md rename to packages/survey-core/docs/Question/visibleIf.md diff --git a/docs/Troubleshooting.md b/packages/survey-core/docs/Troubleshooting.md similarity index 100% rename from docs/Troubleshooting.md rename to packages/survey-core/docs/Troubleshooting.md diff --git a/docs/_config.yml b/packages/survey-core/docs/_config.yml similarity index 100% rename from docs/_config.yml rename to packages/survey-core/docs/_config.yml diff --git a/docs/access-and-modify-survey-results.md b/packages/survey-core/docs/access-and-modify-survey-results.md similarity index 100% rename from docs/access-and-modify-survey-results.md rename to packages/survey-core/docs/access-and-modify-survey-results.md diff --git a/docs/customize-question-types-add-custom-properties-to-a-form.md b/packages/survey-core/docs/customize-question-types-add-custom-properties-to-a-form.md similarity index 100% rename from docs/customize-question-types-add-custom-properties-to-a-form.md rename to packages/survey-core/docs/customize-question-types-add-custom-properties-to-a-form.md diff --git a/docs/customize-question-types-create-composite-question-types.md b/packages/survey-core/docs/customize-question-types-create-composite-question-types.md similarity index 100% rename from docs/customize-question-types-create-composite-question-types.md rename to packages/survey-core/docs/customize-question-types-create-composite-question-types.md diff --git a/docs/customize-question-types-create-custom-widgets.md b/packages/survey-core/docs/customize-question-types-create-custom-widgets.md similarity index 100% rename from docs/customize-question-types-create-custom-widgets.md rename to packages/survey-core/docs/customize-question-types-create-custom-widgets.md diff --git a/docs/customize-question-types-create-specialized-question-types.md b/packages/survey-core/docs/customize-question-types-create-specialized-question-types.md similarity index 100% rename from docs/customize-question-types-create-specialized-question-types.md rename to packages/survey-core/docs/customize-question-types-create-specialized-question-types.md diff --git a/docs/customize-question-types-third-party-component-integration-angular.md b/packages/survey-core/docs/customize-question-types-third-party-component-integration-angular.md similarity index 100% rename from docs/customize-question-types-third-party-component-integration-angular.md rename to packages/survey-core/docs/customize-question-types-third-party-component-integration-angular.md diff --git a/docs/customize-question-types-third-party-component-integration-react.md b/packages/survey-core/docs/customize-question-types-third-party-component-integration-react.md similarity index 100% rename from docs/customize-question-types-third-party-component-integration-react.md rename to packages/survey-core/docs/customize-question-types-third-party-component-integration-react.md diff --git a/docs/customize-question-types-third-party-component-integration-vue.md b/packages/survey-core/docs/customize-question-types-third-party-component-integration-vue.md similarity index 100% rename from docs/customize-question-types-third-party-component-integration-vue.md rename to packages/survey-core/docs/customize-question-types-third-party-component-integration-vue.md diff --git a/docs/data-validation.md b/packages/survey-core/docs/data-validation.md similarity index 100% rename from docs/data-validation.md rename to packages/survey-core/docs/data-validation.md diff --git a/docs/design-survey-conditional-logic.md b/packages/survey-core/docs/design-survey-conditional-logic.md similarity index 98% rename from docs/design-survey-conditional-logic.md rename to packages/survey-core/docs/design-survey-conditional-logic.md index 046d8220b5..82a3250cc7 100644 --- a/docs/design-survey-conditional-logic.md +++ b/packages/survey-core/docs/design-survey-conditional-logic.md @@ -313,7 +313,8 @@ The following built-in functions are available: - [`day`](#day) - [`weekday`](#weekday) - [`getDate`](#getdate) -- [`diffDays`](#diffdays) +- [`dateAdd`](#dateadd) +- [`dateDiff`](#datediff) - [`sum`](#sum) - [`max`](#max) - [`min`](#min) @@ -469,7 +470,7 @@ Returns a Date value converted from a given question's value. *Definition*: `dateAdd(date: any, numberToAdd: number, interval: "days" | "months" | "years"): Date` -Adds a specified number of full days (default), months, or years to a date value. +Adds or subtracts a specified number of full days (default), months, or years to or from a date value. *Example*: `"expression": "dateAdd({startDate}, 14, "days")"` @@ -489,20 +490,6 @@ Returns a difference between two given dates in full days (default), months, or --- -#### `diffDays` - -> This function is obsolete. Use the [`dateDiff`](#datediff) function instead. - -*Definition*: `diffDays(fromDate: any, toDate: any): number` - -Returns the number of days between two given dates. - -*Example*: `"expression": "diffDays({startDate}, {endDate}) < 7"` - -[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L266-L274 (linkStyle)) - ---- - #### `sum` *Definition*: `sum(param1: number, param2: number, ...): number` diff --git a/docs/design-survey-configure-question-titles.md b/packages/survey-core/docs/design-survey-configure-question-titles.md similarity index 100% rename from docs/design-survey-configure-question-titles.md rename to packages/survey-core/docs/design-survey-configure-question-titles.md diff --git a/docs/design-survey-create-a-multi-page-survey.md b/packages/survey-core/docs/design-survey-create-a-multi-page-survey.md similarity index 99% rename from docs/design-survey-create-a-multi-page-survey.md rename to packages/survey-core/docs/design-survey-create-a-multi-page-survey.md index 6a024d2032..eeb24fe9d9 100644 --- a/docs/design-survey-create-a-multi-page-survey.md +++ b/packages/survey-core/docs/design-survey-create-a-multi-page-survey.md @@ -215,7 +215,7 @@ Navigates the respondent to the next page. Returns `false` if the navigation did - [`prevPage()`](https://surveyjs.io/Documentation/Library?id=surveymodel#prevPage) Navigates the respondent to the previous page. Returns `false` if the navigation did not happen, for instance, because the current page is the first page. Unlike with `nextPage()`, validation errors are ignored. -- [`completeLastPage()`](https://surveyjs.io/Documentation/Library?id=surveymodel#completeLastPage) +- [`tryComplete()`](https://surveyjs.io/Documentation/Library?id=surveymodel#tryComplete) Completes the survey. Fails and returns `false` if the current page has validation errors. - [`doComplete()`](https://surveyjs.io/Documentation/Library?id=surveymodel#doComplete) diff --git a/docs/design-survey-create-a-quiz.md b/packages/survey-core/docs/design-survey-create-a-quiz.md similarity index 100% rename from docs/design-survey-create-a-quiz.md rename to packages/survey-core/docs/design-survey-create-a-quiz.md diff --git a/docs/design-survey-create-a-simple-survey.md b/packages/survey-core/docs/design-survey-create-a-simple-survey.md similarity index 100% rename from docs/design-survey-create-a-simple-survey.md rename to packages/survey-core/docs/design-survey-create-a-simple-survey.md diff --git a/docs/design-survey-merge-question-values.md b/packages/survey-core/docs/design-survey-merge-question-values.md similarity index 100% rename from docs/design-survey-merge-question-values.md rename to packages/survey-core/docs/design-survey-merge-question-values.md diff --git a/docs/design-survey-pre-populate-form-fields.md b/packages/survey-core/docs/design-survey-pre-populate-form-fields.md similarity index 100% rename from docs/design-survey-pre-populate-form-fields.md rename to packages/survey-core/docs/design-survey-pre-populate-form-fields.md diff --git a/docs/get-started-angular.md b/packages/survey-core/docs/get-started-angular.md similarity index 100% rename from docs/get-started-angular.md rename to packages/survey-core/docs/get-started-angular.md diff --git a/docs/get-started-html-css-javascript.md b/packages/survey-core/docs/get-started-html-css-javascript.md similarity index 100% rename from docs/get-started-html-css-javascript.md rename to packages/survey-core/docs/get-started-html-css-javascript.md diff --git a/docs/get-started-jquery.md b/packages/survey-core/docs/get-started-jquery.md similarity index 100% rename from docs/get-started-jquery.md rename to packages/survey-core/docs/get-started-jquery.md diff --git a/docs/get-started-knockout.md b/packages/survey-core/docs/get-started-knockout.md similarity index 100% rename from docs/get-started-knockout.md rename to packages/survey-core/docs/get-started-knockout.md diff --git a/docs/get-started-react.md b/packages/survey-core/docs/get-started-react.md similarity index 100% rename from docs/get-started-react.md rename to packages/survey-core/docs/get-started-react.md diff --git a/docs/get-started-vue.md b/packages/survey-core/docs/get-started-vue.md similarity index 100% rename from docs/get-started-vue.md rename to packages/survey-core/docs/get-started-vue.md diff --git a/docs/get-started.md b/packages/survey-core/docs/get-started.md similarity index 100% rename from docs/get-started.md rename to packages/survey-core/docs/get-started.md diff --git a/docs/how-to-save-and-restore-incomplete-survey.md b/packages/survey-core/docs/how-to-save-and-restore-incomplete-survey.md similarity index 100% rename from docs/how-to-save-and-restore-incomplete-survey.md rename to packages/survey-core/docs/how-to-save-and-restore-incomplete-survey.md diff --git a/docs/how-to-store-survey-results.md b/packages/survey-core/docs/how-to-store-survey-results.md similarity index 100% rename from docs/how-to-store-survey-results.md rename to packages/survey-core/docs/how-to-store-survey-results.md diff --git a/docs/icons.md b/packages/survey-core/docs/icons.md similarity index 100% rename from docs/icons.md rename to packages/survey-core/docs/icons.md diff --git a/docs/images/browser-icons-chrome.svg b/packages/survey-core/docs/images/browser-icons-chrome.svg similarity index 100% rename from docs/images/browser-icons-chrome.svg rename to packages/survey-core/docs/images/browser-icons-chrome.svg diff --git a/docs/images/browser-icons-edge.svg b/packages/survey-core/docs/images/browser-icons-edge.svg similarity index 100% rename from docs/images/browser-icons-edge.svg rename to packages/survey-core/docs/images/browser-icons-edge.svg diff --git a/docs/images/browser-icons-firefox.svg b/packages/survey-core/docs/images/browser-icons-firefox.svg similarity index 100% rename from docs/images/browser-icons-firefox.svg rename to packages/survey-core/docs/images/browser-icons-firefox.svg diff --git a/docs/images/browser-icons-ie.svg b/packages/survey-core/docs/images/browser-icons-ie.svg similarity index 100% rename from docs/images/browser-icons-ie.svg rename to packages/survey-core/docs/images/browser-icons-ie.svg diff --git a/docs/images/browser-icons-opera.svg b/packages/survey-core/docs/images/browser-icons-opera.svg similarity index 100% rename from docs/images/browser-icons-opera.svg rename to packages/survey-core/docs/images/browser-icons-opera.svg diff --git a/docs/images/browser-icons-safari.svg b/packages/survey-core/docs/images/browser-icons-safari.svg similarity index 100% rename from docs/images/browser-icons-safari.svg rename to packages/survey-core/docs/images/browser-icons-safari.svg diff --git a/docs/images/choicesbyurl.png b/packages/survey-core/docs/images/choicesbyurl.png similarity index 100% rename from docs/images/choicesbyurl.png rename to packages/survey-core/docs/images/choicesbyurl.png diff --git a/docs/images/class-inheritance-chain.png b/packages/survey-core/docs/images/class-inheritance-chain.png similarity index 100% rename from docs/images/class-inheritance-chain.png rename to packages/survey-core/docs/images/class-inheritance-chain.png diff --git a/docs/images/composite-question-shipping-address-disabled.png b/packages/survey-core/docs/images/composite-question-shipping-address-disabled.png similarity index 100% rename from docs/images/composite-question-shipping-address-disabled.png rename to packages/survey-core/docs/images/composite-question-shipping-address-disabled.png diff --git a/docs/images/composite-question-shipping-address-enabled.png b/packages/survey-core/docs/images/composite-question-shipping-address-enabled.png similarity index 100% rename from docs/images/composite-question-shipping-address-enabled.png rename to packages/survey-core/docs/images/composite-question-shipping-address-enabled.png diff --git a/docs/images/get-started-primitive-survey-alert.png b/packages/survey-core/docs/images/get-started-primitive-survey-alert.png similarity index 100% rename from docs/images/get-started-primitive-survey-alert.png rename to packages/survey-core/docs/images/get-started-primitive-survey-alert.png diff --git a/docs/images/get-started-primitive-survey.png b/packages/survey-core/docs/images/get-started-primitive-survey.png similarity index 100% rename from docs/images/get-started-primitive-survey.png rename to packages/survey-core/docs/images/get-started-primitive-survey.png diff --git a/docs/images/overview.png b/packages/survey-core/docs/images/overview.png similarity index 100% rename from docs/images/overview.png rename to packages/survey-core/docs/images/overview.png diff --git a/docs/images/property-grid-overridding-properties.png b/packages/survey-core/docs/images/property-grid-overridding-properties.png similarity index 100% rename from docs/images/property-grid-overridding-properties.png rename to packages/survey-core/docs/images/property-grid-overridding-properties.png diff --git a/docs/images/survey-get-postid.png b/packages/survey-core/docs/images/survey-get-postid.png similarity index 100% rename from docs/images/survey-get-postid.png rename to packages/survey-core/docs/images/survey-get-postid.png diff --git a/docs/images/survey-id.png b/packages/survey-core/docs/images/survey-id.png similarity index 100% rename from docs/images/survey-id.png rename to packages/survey-core/docs/images/survey-id.png diff --git a/docs/images/survey-library-themes.png b/packages/survey-core/docs/images/survey-library-themes.png similarity index 100% rename from docs/images/survey-library-themes.png rename to packages/survey-core/docs/images/survey-library-themes.png diff --git a/docs/images/survey-structure.svg b/packages/survey-core/docs/images/survey-structure.svg similarity index 100% rename from docs/images/survey-structure.svg rename to packages/survey-core/docs/images/survey-structure.svg diff --git a/docs/images/theme-editor.png b/packages/survey-core/docs/images/theme-editor.png similarity index 100% rename from docs/images/theme-editor.png rename to packages/survey-core/docs/images/theme-editor.png diff --git a/docs/images/theme-export.png b/packages/survey-core/docs/images/theme-export.png similarity index 100% rename from docs/images/theme-export.png rename to packages/survey-core/docs/images/theme-export.png diff --git a/docs/manage-default-themes-and-styles.md b/packages/survey-core/docs/manage-default-themes-and-styles.md similarity index 100% rename from docs/manage-default-themes-and-styles.md rename to packages/survey-core/docs/manage-default-themes-and-styles.md diff --git a/docs/overview.md b/packages/survey-core/docs/overview.md similarity index 100% rename from docs/overview.md rename to packages/survey-core/docs/overview.md diff --git a/docs/sidebar.json b/packages/survey-core/docs/sidebar.json similarity index 100% rename from docs/sidebar.json rename to packages/survey-core/docs/sidebar.json diff --git a/docs/supported-browsers.md b/packages/survey-core/docs/supported-browsers.md similarity index 100% rename from docs/supported-browsers.md rename to packages/survey-core/docs/supported-browsers.md diff --git a/docs/survey-localization.md b/packages/survey-core/docs/survey-localization.md similarity index 100% rename from docs/survey-localization.md rename to packages/survey-core/docs/survey-localization.md diff --git a/docs/surveyjs_definition.json b/packages/survey-core/docs/surveyjs_definition.json similarity index 99% rename from docs/surveyjs_definition.json rename to packages/survey-core/docs/surveyjs_definition.json index d040ff1310..9e60be787e 100644 --- a/docs/surveyjs_definition.json +++ b/packages/survey-core/docs/surveyjs_definition.json @@ -66,6 +66,9 @@ "sendResultOnPageNext": { "type": "boolean" }, + "partialSendEnabled": { + "type": "boolean" + }, "surveyShowDataSaving": { "type": "boolean" }, @@ -137,6 +140,9 @@ "maxOthersLength": { "type": "number" }, + "maxCommentLength": { + "type": "number" + }, "goNextPageAutomatic": { "type": [ "boolean", diff --git a/docs/surveymodel/onGetQuestionTitle.md b/packages/survey-core/docs/surveymodel/onGetQuestionTitle.md similarity index 100% rename from docs/surveymodel/onGetQuestionTitle.md rename to packages/survey-core/docs/surveymodel/onGetQuestionTitle.md diff --git a/docs/test.md b/packages/survey-core/docs/test.md similarity index 100% rename from docs/test.md rename to packages/survey-core/docs/test.md diff --git a/docs/uri.json b/packages/survey-core/docs/uri.json similarity index 100% rename from docs/uri.json rename to packages/survey-core/docs/uri.json diff --git a/packages/survey-core/package.json b/packages/survey-core/package.json index 4b926ecbc6..7fd4f0583e 100644 --- a/packages/survey-core/package.json +++ b/packages/survey-core/package.json @@ -1,14 +1,20 @@ { "name": "survey-core", - "version": "1.8.33", + "version": "2.0.0", "scripts": { "build": "webpack --env buildType=dev && webpack --env buildType=prod", "build:esm": "webpack --config ./webpack.esm.config.mjs --env buildType=dev", "build:i18n": "webpack --config ./webpack.i18n.config.js --env buildType=dev && webpack --config ./webpack.i18n.config.js --env buildType=prod", "build:themes": "webpack --config ./webpack.themes.config.js --env buildType=dev && webpack --config ./webpack.themes.config.js --env buildType=prod", - "build:all": "npm run build && npm run build:i18n && npm run build:themes", + "build:icons": "webpack --config ./webpack.icons.config.js --env buildType=dev && webpack --config ./webpack.icons.config.js --env buildType=prod", + "watch:dev": "webpack --env.buildType dev --watch", + "build:all": "npm run build && npm run build:i18n && npm run build:themes && npm run build:icons", "test": "karma start ./karma.conf.js --single-run", - "test:watch": "karma start ./karma.conf.js" + "test:watch": "karma start ./karma.conf.js", + "test:postcss": "postcss build/defaultV2.css --silent -u postcss-calc -u autoprefixer -u postcss-fail-on-warn -o defaultV2.postcss.css && rimraf defaultV2.postcss.css", + "doc_gen": "node doc_generator/lib_docgenerator.js ./entries/chunks/model.ts", + "doc_update": "chmod +x ./docupdate_npm.sh && ./docupdate_npm.sh", + "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" " }, "main": "survey.core.js", "repository": { @@ -20,6 +26,7 @@ "@types/node": "7.0.4", "@types/papaparse": "^5.0.4", "@types/qunit": "2.0.31", + "@types/signature_pad": "^2.3.0", "ace-builds": "1.2.2", "ajv": "8.17.1", "async": "3.2.5", @@ -47,7 +54,7 @@ "rimraf": "2.5.4", "sass": "^1.62.1", "sass-loader": "^8.0.2", - "standard-version": "^9.5.0", + "commit-and-tag-version": "^11.0.0", "style-loader": "^1.2.1", "surveyjs-doc-generator": "git+https://github.com/surveyjs/surveyjs-doc-generator.git", "svg-inline-loader": "^0.8.2", @@ -62,9 +69,11 @@ "webpack-dev-server": "^5.0.4", "webpack-fix-style-only-entries": "^0.6.1", "webpack-merge": "^5.8.0", - "webpack-remove-empty-scripts": "^1.0.4" + "webpack-remove-empty-scripts": "^1.0.4", + "tsconfig-paths-webpack-plugin": "^3.3.0", + "signature_pad": "^4.1.5" }, - "standard-version": { + "commit-and-tag-version": { "skip": { "tag": true } diff --git a/packages/survey-core/src/base-interfaces.ts b/packages/survey-core/src/base-interfaces.ts index c135d71e14..4fe2a588af 100644 --- a/packages/survey-core/src/base-interfaces.ts +++ b/packages/survey-core/src/base-interfaces.ts @@ -159,8 +159,16 @@ export interface ISurvey extends ITextProcessor, ISurveyErrorOwner { storeOthersAsComment: boolean; maxTextLength: number; + /** + * @deprecated Use `maxCommentLength` instead. + */ maxOthersLength: number; + maxCommentLength: number; + /** + * @deprecated Use `clearDisabledChoices` instead. + */ clearValueOnDisableItems: boolean; + clearDisabledChoices: boolean; timeLimitPerPage: number; diff --git a/packages/survey-core/src/defaultCss/defaultV2Css.ts b/packages/survey-core/src/defaultCss/defaultV2Css.ts index a6744d8790..6bdfcfe6c9 100644 --- a/packages/survey-core/src/defaultCss/defaultV2Css.ts +++ b/packages/survey-core/src/defaultCss/defaultV2Css.ts @@ -1,5 +1,5 @@ export var surveyCss: any = { - currentType: "", + currentType: "defaultV2", getCss: function () { var loc = this.currentType ? this[this.currentType] : defaultV2Css; if (!loc) loc = defaultV2Css; diff --git a/packages/survey-core/src/popup-dropdown-view-model.ts b/packages/survey-core/src/popup-dropdown-view-model.ts index 849a4617fb..36d8daad71 100644 --- a/packages/survey-core/src/popup-dropdown-view-model.ts +++ b/packages/survey-core/src/popup-dropdown-view-model.ts @@ -40,7 +40,7 @@ export class PopupDropdownViewModel extends PopupBaseViewModel { } private resizeWindowCallback = () => { if(!this.isOverlay) { - this.updatePosition(true, SurveyModel.platform === "vue" || SurveyModel.platform === "vue3" || SurveyModel.platform == "react"); + this.updatePosition(true, SurveyModel.platform === "vue" || SurveyModel.platform === "vue3" || SurveyModel.platform == "react" || SurveyModel.platform == "js-ui"); } }; private clientY: number = 0; diff --git a/packages/survey-core/src/question.ts b/packages/survey-core/src/question.ts index 71c8da72d4..cdac047885 100644 --- a/packages/survey-core/src/question.ts +++ b/packages/survey-core/src/question.ts @@ -1331,7 +1331,7 @@ export class Question extends SurveyElement } public getOthersMaxLength(): any { if (!this.survey) return null; - return this.survey.maxOthersLength > 0 ? this.survey.maxOthersLength : null; + return this.survey.maxCommentLength > 0 ? this.survey.maxCommentLength : null; } protected onCreating(): void { } public getFirstQuestionToFocus(withError: boolean): Question { diff --git a/packages/survey-core/src/question_baseselect.ts b/packages/survey-core/src/question_baseselect.ts index 280acfa8f3..6574bb7d01 100644 --- a/packages/survey-core/src/question_baseselect.ts +++ b/packages/survey-core/src/question_baseselect.ts @@ -1718,7 +1718,7 @@ export class QuestionSelectBase extends Question { return item.value === this.value; } private clearDisabledValues() { - if (!this.survey || !this.survey.clearValueOnDisableItems) return; + if (!this.survey || !this.survey.clearDisabledChoices) return; this.clearDisabledValuesCore(); } protected clearIncorrectValuesCore() { diff --git a/packages/survey-core/src/question_multipletext.ts b/packages/survey-core/src/question_multipletext.ts index c66479567b..2111a00ac2 100644 --- a/packages/survey-core/src/question_multipletext.ts +++ b/packages/survey-core/src/question_multipletext.ts @@ -217,7 +217,7 @@ export class MultipleTextItemModel extends Base /** * A value passed on to the [`size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size) attribute of the underlying `` element. * - * If you want to set a uniform `size` for all text box items, use the [`itemSize`](https://surveyjs.io/form-library/documentation/api-reference/multiple-text-entry-question-model#itemSize) within the Multiple Textboxes configuration. + * If you want to set a uniform `size` for all text box items, use the [`inputSize`](https://surveyjs.io/form-library/documentation/api-reference/multiple-text-entry-question-model#inputSize) within the Multiple Textboxes configuration. */ public get size(): number { return this.editor.size; @@ -433,7 +433,7 @@ export class QuestionMultipleTextModel extends Question this.registerPropertyChangedHandlers(["items", "colCount", "itemErrorLocation"], () => { this.calcVisibleRows(); }); - this.registerPropertyChangedHandlers(["itemSize"], () => { this.updateItemsSize(); }); + this.registerPropertyChangedHandlers(["inputSize"], () => { this.updateItemsSize(); }); } public getType(): string { return "multipletext"; @@ -620,12 +620,18 @@ export class QuestionMultipleTextModel extends Question /** * A value passed on to the [`size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size) attribute of the underlying `` elements. */ - public get itemSize(): number { - return this.getPropertyValue("itemSize"); + public get inputSize(): number { + return this.getPropertyValue("inputSize"); } - public set itemSize(val: number) { - this.setPropertyValue("itemSize", val); + public set inputSize(val: number) { + this.setPropertyValue("inputSize", val); } + /** + * Obsolete. Use the [`inputSize`](https://surveyjs.io/form-library/documentation/api-reference/multiple-text-entry-question-model#inputSize) property instead. + * @deprecated + */ + public get itemSize(): number { return this.inputSize; } + public set itemSize(val: number) { this.inputSize = val; } /** * Specifies a uniform width for all text box titles. Accepts CSS values. * @@ -993,7 +999,7 @@ Serializer.addClass( "multipletext", [ { name: "!items:textitems", className: "multipletextitem", isArray: true }, - { name: "itemSize:number", minValue: 0, visible: false }, + { name: "inputSize:number", minValue: 0, visible: false, alternativeName: "itemSize" }, { name: "colCount:number", default: 1, choices: [1, 2, 3, 4, 5] }, { name: "itemErrorLocation", default: "default", choices: ["default", "top", "bottom"], visible: false }, { name: "itemTitleWidth", category: "layout" } diff --git a/packages/survey-core/src/question_paneldynamic.ts b/packages/survey-core/src/question_paneldynamic.ts index 0d30222b4f..3d7938e254 100644 --- a/packages/survey-core/src/question_paneldynamic.ts +++ b/packages/survey-core/src/question_paneldynamic.ts @@ -1396,7 +1396,7 @@ export class QuestionPanelDynamicModel extends Question /** * If it is not empty, then this value is set to every new panel, including panels created initially, unless the defaultValue is not empty * @see defaultValue - * @see defaultValueFromLastPanel + * @see copyDefaultValueFromLastEntry */ public get defaultPanelValue(): any { return this.getPropertyValue("defaultPanelValue"); @@ -1410,11 +1410,21 @@ export class QuestionPanelDynamicModel extends Question * If you also specify `defaultValue`, it will be merged with the copied values. * @see defaultValue */ + public get copyDefaultValueFromLastEntry(): boolean { + return this.getPropertyValue("copyDefaultValueFromLastEntry"); + } + public set copyDefaultValueFromLastEntry(val: boolean) { + this.setPropertyValue("copyDefaultValueFromLastEntry", val); + } + /** + * Obsolete. Use the [`copyDefaultValueFromLastEntry`](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#copyDefaultValueFromLastEntry) property instead. + * @deprecated + */ public get defaultValueFromLastPanel(): boolean { - return this.getPropertyValue("defaultValueFromLastPanel"); + return this.copyDefaultValueFromLastEntry; } public set defaultValueFromLastPanel(val: boolean) { - this.setPropertyValue("defaultValueFromLastPanel", val); + this.copyDefaultValueFromLastEntry = val; } protected isDefaultValueEmpty(): boolean { return ( @@ -1527,7 +1537,7 @@ export class QuestionPanelDynamicModel extends Question hasModified = true; this.copyValue(newValue[index], this.defaultPanelValue); } - if (this.defaultValueFromLastPanel && newValue.length > 1) { + if (this.copyDefaultValueFromLastEntry && newValue.length > 1) { const fromIndex = prevIndex > -1 && prevIndex <= lastIndex ? prevIndex : lastIndex; hasModified = true; this.copyValue(newValue[index], newValue[fromIndex]); @@ -2654,7 +2664,7 @@ Serializer.addClass( defaultFunc: () => settings.panel.maxPanelCount, }, "defaultPanelValue:panelvalue", - "defaultValueFromLastPanel:boolean", + { name: "copyDefaultValueFromLastEntry:boolean", alternativeName: "defaultValueFromLastPanel" }, { name: "panelsState", default: "default", diff --git a/packages/survey-core/src/question_text.ts b/packages/survey-core/src/question_text.ts index aab4b7028e..2f91e63936 100644 --- a/packages/survey-core/src/question_text.ts +++ b/packages/survey-core/src/question_text.ts @@ -212,9 +212,9 @@ export class QuestionTextModel extends QuestionTextBase { this.isTextInput && size < 1 && this.parent && - !!(this.parent)["itemSize"] + !!(this.parent)["inputSize"] ) { - size = (this.parent)["itemSize"]; + size = (this.parent)["inputSize"]; } this.setPropertyValue("inputSize", size); this.setPropertyValue("inputWidth", size > 0 ? "auto" : ""); diff --git a/packages/survey-core/src/survey.ts b/packages/survey-core/src/survey.ts index d284dc6e1c..3124501215 100644 --- a/packages/survey-core/src/survey.ts +++ b/packages/survey-core/src/survey.ts @@ -198,7 +198,7 @@ export class SurveyModel extends SurveyElementCore */ public onStarted: EventBase = this.addEvent(); /** - * An event that is raised to save incomplete survey results. Enable the [`sendResultOnPageNext`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#sendResultOnPageNext) property for this event to occur. + * An event that is raised to save incomplete survey results. Enable the [`partialSendEnabled`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#partialSendEnabled) property for this event to occur. * * For information on event handler parameters, refer to descriptions within the interface. * @@ -1333,7 +1333,7 @@ export class SurveyModel extends SurveyElementCore return new CssClassBuilder().append(main) .append(btn).toString(); } - private lazyRenderingValue: boolean; + private lazyRenderingEnabledValue: boolean; @property() showBrandInfo: boolean; @property() enterKeyAction: "moveToNextEditor" | "loseFocus" | "default"; /** @@ -1346,19 +1346,29 @@ export class SurveyModel extends SurveyElementCore * [View Demo](https://surveyjs.io/form-library/examples/survey-lazy/ (linkStyle)) * @see [settings.lazyRender](https://surveyjs.io/form-library/documentation/api-reference/settings#lazyRender) */ - public get lazyRendering(): boolean { - return this.lazyRenderingValue === true; + public get lazyRenderingEnabled(): boolean { + return this.lazyRenderingEnabledValue === true; } - public set lazyRendering(val: boolean) { - if (this.lazyRendering === val) return; - this.lazyRenderingValue = val; + public set lazyRenderingEnabled(val: boolean) { + if (this.lazyRenderingEnabled === val) return; + this.lazyRenderingEnabledValue = val; const page: PageModel = this.currentPage; if (!!page) { page.updateRows(); } } + /** + * Obsolete. Use the [`lazyRenderingEnabled`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#lazyRenderingEnabled) property instead. + * @deprecated + */ + public get lazyRendering(): boolean { + return this.lazyRenderingEnabled; + } + public set lazyRendering(val: boolean) { + this.lazyRenderingEnabled = val; + } public get isLazyRendering(): boolean { - return this.lazyRendering || settings.lazyRender.enabled; + return this.lazyRenderingEnabled || settings.lazyRender.enabled; } @property() lazyRenderingFirstBatchSizeValue: number; public get lazyRenderingFirstBatchSize(): number { @@ -1464,11 +1474,21 @@ export class SurveyModel extends SurveyElementCore * * Alternatively, you can handle the [`onCurrentPageChanged`](#onCurrentPageChanged) and [`onValueChanged`](#onValueChanged) events, as shown in the following demo: [Continue an Incomplete Survey](https://surveyjs.io/form-library/examples/survey-editprevious/). */ + public get partialSendEnabled(): boolean { + return this.getPropertyValue("partialSendEnabled"); + } + public set partialSendEnabled(val: boolean) { + this.setPropertyValue("partialSendEnabled", val); + } + /** + * Obsolete. Use the [`partialSend`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#partialSend) property instead. + * @deprecated + */ public get sendResultOnPageNext(): boolean { - return this.getPropertyValue("sendResultOnPageNext"); + return this.partialSendEnabled; } public set sendResultOnPageNext(val: boolean) { - this.setPropertyValue("sendResultOnPageNext", val); + this.partialSendEnabled = val; } /** * Specifies whether to show progress when the survey sends data to [SurveyJS Service](https://api.surveyjs.io). @@ -1721,7 +1741,7 @@ export class SurveyModel extends SurveyElementCore * Default value: `true` * * Respondents can leave comments when they select "Other" in choice-based questions, such as Dropdown or Checkboxes. Comment values are saved in a separate property. The property name is composed of the question `name` and [`commentSuffix`](#commentSuffix). However, you can use the question `name` as a key to store the comment value instead. Disable the `storeOthersAsComment` property in this case. - * @see maxOthersLength + * @see maxCommentLength */ public get storeOthersAsComment(): boolean { return this.getPropertyValue("storeOthersAsComment"); @@ -1735,7 +1755,7 @@ export class SurveyModel extends SurveyElementCore * Default value: 0 (unlimited) * * You can override this setting for individual questions if you specify their [`maxLength`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#maxLength) property. - * @see maxOthersLength + * @see maxCommentLength */ public get maxTextLength(): number { return this.getPropertyValue("maxTextLength"); @@ -1749,11 +1769,21 @@ export class SurveyModel extends SurveyElementCore * Default value: 0 (unlimited) * @see maxTextLength */ + public get maxCommentLength(): number { + return this.getPropertyValue("maxCommentLength"); + } + public set maxCommentLength(val: number) { + this.setPropertyValue("maxCommentLength", val); + } + /** + * Obsolete. Use the [`maxCommentLength`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#maxCommentLength) property instead. + * @deprecated + */ public get maxOthersLength(): number { - return this.getPropertyValue("maxOthersLength"); + return this.maxCommentLength; } public set maxOthersLength(val: number) { - this.setPropertyValue("maxOthersLength", val); + this.maxCommentLength = val; } /** @@ -3427,7 +3457,8 @@ export class SurveyModel extends SurveyElementCore this.currentPageNo = index; return true; } - for (let i = this.currentPageNo; i < index; i++) { + if(!this.validateCurrentPage()) return false; + for (let i = this.currentPageNo + 1; i < index; i++) { const page = this.visiblePages[i]; if (!page.validate(true, true)) return false; page.passed = true; @@ -3776,7 +3807,7 @@ export class SurveyModel extends SurveyElementCore } public get isNavigationButtonsShowing(): string { if (this.isDesignMode) return "none"; - var page = this.currentPage; + var page = this.activePage; if (!page) return "none"; if (page.navigationButtonsVisibility === "show") { return this.showNavigationButtons === "none" ? "bottom" : this.showNavigationButtons; @@ -4848,7 +4879,7 @@ export class SurveyModel extends SurveyElementCore var curPage = this.currentPage; this.checkOnPageTriggers(false); if (!this.isCompleted) { - if (this.sendResultOnPageNext) { + if (this.partialSendEnabled) { this.sendResult(this.surveyPostId, this.clientId, true); } if (curPage === this.currentPage) { @@ -6935,11 +6966,21 @@ export class SurveyModel extends SurveyElementCore * * > This property cannot be specified in the survey JSON schema. Use dot notation to specify it. */ + public get clearDisabledChoices(): boolean { + return this.getPropertyValue("clearDisabledChoices", false); + } + public set clearDisabledChoices(val: boolean) { + this.setPropertyValue("clearDisabledChoices", val); + } + /** + * Obsolete. Use the [`clearDisabledChoices`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#clearDisabledChoices) property instead. + * @deprecated + */ public get clearValueOnDisableItems(): boolean { - return this.getPropertyValue("clearValueOnDisableItems", false); + return this.clearDisabledChoices; } public set clearValueOnDisableItems(val: boolean) { - this.setPropertyValue("clearValueOnDisableItems", val); + this.clearDisabledChoices = val; } getQuestionClearIfInvisible(questionClearIf: string): string { if (this.isShowingPreview || this.runningPages) return "none"; @@ -8187,7 +8228,7 @@ Serializer.addClass("survey", [ { name: "surveyPostId", visible: false }, { name: "surveyShowDataSaving:boolean", visible: false }, "cookieName", - "sendResultOnPageNext:boolean", + { name: "partialSendEnabled:boolean", alternativeName: "sendResultOnPageNext" }, { name: "showNavigationButtons", default: "bottom", @@ -8280,7 +8321,7 @@ Serializer.addClass("survey", [ { name: "mode", default: "edit", choices: ["edit", "display"] }, { name: "storeOthersAsComment:boolean", default: true }, { name: "maxTextLength:number", default: 0, minValue: 0 }, - { name: "maxOthersLength:number", default: 0, minValue: 0 }, + { name: "maxCommentLength:number", default: 0, minValue: 0, alternativeName: "maxOthersLength" }, { name: "goNextPageAutomatic:boolean", onSetValue: function (obj: any, value: any) { diff --git a/packages/survey-core/tests/jsonSchemaTests.ts b/packages/survey-core/tests/jsonSchemaTests.ts index a5640a207c..2f03ceee57 100644 --- a/packages/survey-core/tests/jsonSchemaTests.ts +++ b/packages/survey-core/tests/jsonSchemaTests.ts @@ -13,9 +13,9 @@ QUnit.test("generate survey schema", function (assert) { assert.equal(schema.title, "SurveyJS Library json schema"); assert.equal(schema.properties.surveyId.type, "string", "surveyId is string"); assert.equal( - schema.properties.sendResultOnPageNext.type, + schema.properties.partialSendEnabled.type, "boolean", - "sendResultOnPageNext is boolean" + "partialSendEnabled is boolean" ); assert.deepEqual(schema.properties.title, { "oneOf": [ diff --git a/src/defaultCss/cssstandard.ts b/packages/survey-core/tests/oldTheme.ts similarity index 96% rename from src/defaultCss/cssstandard.ts rename to packages/survey-core/tests/oldTheme.ts index 46476f28d7..d3cdd661c0 100644 --- a/src/defaultCss/cssstandard.ts +++ b/packages/survey-core/tests/oldTheme.ts @@ -1,426 +1,422 @@ -import { surveyCss } from "../../packages/survey-core/src/defaultCss/defaultV2Css"; - -export var defaultStandardCss = { - root: "sv_main sv_default_css", - rootProgress: "sv_progress", - container: "sv_container", - header: "sv_header", - bodyContainer: "sv-components-row", - body: "sv_body", - bodyEmpty: "sv_body sv_body_empty", - footer: "sv_nav", - title: "", - description: "", - logo: "sv_logo", - logoImage: "sv_logo__image", - headerText: "sv_header__text", - navigationButton: "sv_nav_btn", - completedPage: "sv_completed_page", - navigation: { - complete: "sv_complete_btn", - prev: "sv_prev_btn", - next: "sv_next_btn", - start: "sv_start_btn", - preview: "sv_preview_btn", - edit: "sv_edit_btn", - }, - progress: "sv_progress", - progressBar: "sv_progress_bar", - progressTextInBar: "sv-hidden", - progressButtonsContainerCenter: "sv_progress-buttons__container-center", - progressButtonsContainer: "sv_progress-buttons__container", - progressButtonsImageButtonLeft: "sv_progress-buttons__image-button-left", - progressButtonsImageButtonRight: "sv_progress-buttons__image-button-right", - progressButtonsImageButtonHidden: "sv_progress-buttons__image-button--hidden", - progressButtonsListContainer: "sv_progress-buttons__list-container", - progressButtonsList: "sv_progress-buttons__list", - progressButtonsListElementPassed: "sv_progress-buttons__list-element--passed", - progressButtonsListElementCurrent: - "sv_progress-buttons__list-element--current", - progressButtonsListElementNonClickable: - "sv_progress-buttons__list-element--nonclickable", - progressButtonsPageTitle: "sv_progress-buttons__page-title", - progressButtonsPageDescription: "sv_progress-buttons__page-description", - page: { - root: "sv_p_root", - title: "sv_page_title", - description: "", - }, - // TODO: move to the page object - pageTitle: "sv_page_title", - pageDescription: "", - row: "sv_row", - question: { - mainRoot: "sv_q sv_qstn", - flowRoot: "sv_q_flow sv_qstn", - header: "", - headerLeft: "title-left", - content: "", - contentLeft: "content-left", - titleLeftRoot: "sv_qstn_left", - requiredText: "sv_q_required_text", - title: "sv_q_title", - titleExpandable: "sv_q_title_expandable", - titleExpandableSvg: "sd-element__title-expandable-svg", - titleExpanded: "sv_q_title_expanded", - titleCollapsed: "sv_q_title_collapsed", - number: "sv_q_num", - description: "sv_q_description", - comment: "", - required: "", - titleRequired: "", - hasError: "", - indent: 20, - footer: "sv_q_footer", - formGroup: "form-group", - asCell: "sv_matrix_cell", - icon: "sv_question_icon", - iconExpanded: "sv_expanded", - disabled: "sv_q--disabled", - }, - panel: { - title: "sv_p_title", - titleExpandable: "sv_p_title_expandable", - titleExpandableSvg: "sd-element__title-expandable-svg", - titleExpanded: "sv_p_title_expanded", - titleCollapsed: "sv_p_title_collapsed", - titleOnError: "", - icon: "sv_panel_icon", - iconExpanded: "sv_expanded", - description: "sv_p_description", - container: "sv_p_container", - footer: "sv_p_footer", - number: "sv_q_num", - requiredText: "sv_q_required_text", - }, - error: { - root: "sv_q_erbox", - icon: "", - item: "", - locationTop: "sv_qstn_error_top", - locationBottom: "sv_qstn_error_bottom", - }, - - boolean: { - root: "sv_qcbc sv_qbln", - rootRadio: "sv_qcbc sv_qbln", - item: "sv-boolean", - control: "sv-visuallyhidden", - itemChecked: "sv-boolean--checked checked", - itemIndeterminate: "sv-boolean--indeterminate", - itemDisabled: "sv-boolean--disabled", - switch: "sv-boolean__switch", - slider: "sv-boolean__slider", - label: "sv-boolean__label ", - disabledLabel: "sv-boolean__label--disabled", - sliderGhost: "sv-boolean__thumb-ghost", - //checkbox - rootCheckbox: "sv_qcbc sv_qbln", - checkboxItem: "sv-boolean", - checkboxItemChecked: "sv-boolean--checked", - controlCheckbox: "sv-visuallyvisible", - checkboxControlLabel: "sv-boolean__label", - checkboxItemIndeterminate: "sv-boolean--indeterminate", - checkboxItemDisabled: "sv-item--disabled sv-boolean--disabled", - checkboxMaterialDecorator: "sv-item__decorator sv-boolean__decorator", - checkboxItemDecorator: "sv-item__svg sv-boolean__svg", - }, - checkbox: { - root: "sv_qcbc sv_qcbx", - item: "sv_q_checkbox", - itemSelectAll: "sv_q_checkbox_selectall", - itemNone: "sv_q_checkbox_none", - itemChecked: "checked", - itemInline: "sv_q_checkbox_inline", - label: "sv_q_checkbox_label", - labelChecked: "", - itemControl: "sv_q_checkbox_control_item", - itemDecorator: "sv-hidden", - controlLabel: "sv_q_checkbox_control_label", - other: "sv_q_other sv_q_checkbox_other", - column: "sv_q_select_column", - }, - ranking: { - root: "sv-ranking", - rootMobileMod: "sv-ranking--mobile", - rootDragMod: "sv-ranking--drag", - rootDisabled: "sv-ranking--disabled", - rootDragHandleAreaIcon: "sv-ranking--drag-handle-area-icon", - rootSelectToRankMod: "sv-ranking--select-to-rank", - rootSelectToRankAlignVertical: "sv-ranking--select-to-rank-vertical", - rootSelectToRankAlignHorizontal: "sv-ranking--select-to-rank-horizontal", - rootSelectToRankSwapAreas: "sv-ranking--select-to-rank-swap-areas", - item: "sv-ranking-item", - itemContent: "sv-ranking-item__content", - itemIndex: "sv-ranking-item__index", - itemIndexEmptyMode: "sv-ranking-item__index--empty", - // itemText: "sv-ranking-item__text", - controlLabel: "sv-ranking-item__text", - itemGhostNode: "sv-ranking-item__ghost", - itemIconContainer: "sv-ranking-item__icon-container", - itemIcon: "sv-ranking-item__icon", - itemIconHoverMod: "sv-ranking-item__icon--hover", - itemIconFocusMod: "sv-ranking-item__icon--focus", - itemGhostMod: "sv-ranking-item--ghost", - itemDragMod: "sv-ranking-item--drag", - container: "sv-ranking__container", - containerEmptyMode: "sv-ranking__container--empty", - containerFromMode: "sv-ranking__container--from", - containerToMode: "sv-ranking__container--to", - containerPlaceholder: "sv-ranking__container-placeholder", - containersDivider: "sv-ranking__containers-divider", - }, - comment: { - remainingCharacterCounter: "sv-remaining-character-counter", - }, - dropdown: { - root: "", - popup: "sv-dropdown-popup", - control: "sv_q_dropdown_control", - controlInputFieldComponent: "sv_q_dropdown_control__input-field-component", - selectWrapper: "sv_select_wrapper", - other: "sv_q_dd_other", - cleanButton: "sv_q_dropdown_clean-button", - cleanButtonSvg: "sv_q_dropdown_clean-button-svg", - cleanButtonIconId: "icon-clear_16x16", - controlValue: "sv_q_dropdown__value", - filterStringInput: "sv_q_dropdown__filter-string-input", - hintPrefix: "sv_q_dropdown__hint-prefix", - hintSuffix: "sv_q_dropdown__hint-suffix" - }, - html: { root: "" }, - image: { - root: "sv_q_image", - image: "sv_image_image", - noImage: "sv-image__no-image", - noImageSvgIconId: "icon-no-image", - }, - matrix: { - root: "sv_q_matrix", - label: "sv_q_m_label", - itemChecked: "checked", - itemDecorator: "sv-hidden", - cell: "sv_q_m_cell", - cellText: "sv_q_m_cell_text", - cellTextSelected: "sv_q_m_cell_selected", - cellLabel: "sv_q_m_cell_label", - cellResponsiveTitle: "sv_q_m_cell_responsive_title" - }, - matrixdropdown: { - root: "sv_q_matrix_dropdown", - cell: "sv_matrix_cell", - cellResponsiveTitle: "sv_matrix_cell_responsive_title", - headerCell: "sv_matrix_cell_header", - row: "sv_matrix_row", - rowAdditional: "sv-matrix__row--additional", - rowTextCell: "sv-table__cell--row-text", - detailRow: "sv_matrix_detail_row", - detailRowText: "sv_matrix_cell_detail_rowtext", - detailCell: "sv_matrix_cell_detail", - choiceCell: "sv-table__cell--choice", - detailButton: "sv_matrix_cell_detail_button", - detailButtonExpanded: "sv_matrix_cell_detail_button_expanded", - detailIcon: "sv_detail_panel_icon", - detailIconExpanded: "sv_detail_expanded", - detailPanelCell: "sv_matrix_cell_detail_panel", - actionsCell: "sv_matrix_cell sv_matrix_cell_actions", - }, - matrixdynamic: { - root: "sv_q_matrix_dynamic", - button: "sv_matrix_dynamic_button", - buttonAdd: "sv_matrix_dynamic_button--add", - buttonRemove: "", - iconAdd: "", - iconRemove: "", - iconDrag: "sv-matrixdynamic__drag-icon", - cell: "sv_matrix_cell", - cellResponsiveTitle: "sv_matrix_cell_responsive_title", - headerCell: "sv_matrix_cell_header", - row: "sv_matrix_row", - detailRow: "sv_matrix_detail_row", - detailCell: "sv_matrix_cell_detail", - choiceCell: "sv-table__cell--choice", - detailButton: "sv_matrix_cell_detail_button", - detailButtonExpanded: "sv_matrix_cell_detail_button_expanded", - detailIcon: "sv_detail_panel_icon", - detailIconExpanded: "sv_detail_expanded", - detailPanelCell: "sv_matrix_cell_detail_panel", - actionsCell: "sv_matrix_cell sv_matrix_cell_actions", - emptyRowsSection: "sv_matrix_empty_rows_section", - emptyRowsText: "sv_matrix_empty_rows_text", - emptyRowsButton: "", - ghostRow: "sv-matrix-row--drag-drop-ghost-mod", - draggedRow: "sv-matrixdynamic-dragged-row" - }, - paneldynamic: { - root: "sv_panel_dynamic", - title: "sv_p_title", - header: "sv-paneldynamic__header sv_header", - headerTab: "sv-paneldynamic__header-tab", - button: "", - buttonAdd: "sv-paneldynamic__add-btn", - buttonRemove: "sv_p_remove_btn", - buttonRemoveRight: "sv_p_remove_btn_right", - buttonPrev: "sv-paneldynamic__prev-btn", - buttonPrevDisabled: "sv-paneldynamic__prev-btn--disabled", - buttonNextDisabled: "sv-paneldynamic__next-btn--disabled", - buttonNext: "sv-paneldynamic__next-btn", - progressContainer: "sv-paneldynamic__progress-container", - progress: "sv-progress", - progressBar: "sv-progress__bar", - progressText: "sv-paneldynamic__progress-text", - panelWrapper: "sv_p_wrapper", - panelWrapperInRow: "sv_p_wrapper_in_row", - footer: "", - progressBtnIcon: "icon-progressbutton" - }, - multipletext: { - root: "sv_q_mt", - itemTitle: "sv_q_mt_title", - item: "sv_q_mt_item", - row: "sv_q_mt_row", - itemLabel: "sv_q_mt_label", - itemValue: "sv_q_mt_item_value sv_q_text_root", - }, - radiogroup: { - root: "sv_qcbc", - item: "sv_q_radiogroup", - itemChecked: "checked", - itemInline: "sv_q_radiogroup_inline", - itemDecorator: "sv-hidden", - label: "sv_q_radiogroup_label", - labelChecked: "", - itemControl: "sv_q_radiogroup_control_item", - controlLabel: "", - other: "sv_q_other sv_q_radiogroup_other", - clearButton: "sv_q_radiogroup_clear", - column: "sv_q_select_column", - }, - buttongroup: { - root: "sv-button-group", - item: "sv-button-group__item", - itemIcon: "sv-button-group__item-icon", - itemDecorator: "sv-button-group__item-decorator", - itemCaption: "sv-button-group__item-caption", - itemHover: "sv-button-group__item--hover", - itemSelected: "sv-button-group__item--selected", - itemDisabled: "sv-button-group__item--disabled", - itemControl: "sv-visuallyhidden", - }, - imagepicker: { - root: "sv_imgsel", - item: "sv_q_imgsel", - itemChecked: "checked", - label: "sv_q_imgsel_label", - itemControl: "sv_q_imgsel_control_item", - image: "sv_q_imgsel_image", - itemInline: "sv_q_imagepicker_inline", - itemText: "sv_q_imgsel_text", - clearButton: "sv_q_radiogroup_clear", - column: "sv_q_select_column", - itemNoImage: "sv_q_imgsel__no-image", - itemNoImageSvgIcon: "sv_q_imgsel__no-image-svg", - itemNoImageSvgIconId: "icon-no-image", - }, - rating: { - root: "sv_q_rating", - item: "sv_q_rating_item", - itemFixedSize: "sv_q_rating_item_fixed", - selected: "active", - minText: "sv_q_rating_min_text", - itemText: "sv_q_rating_item_text", - maxText: "sv_q_rating_max_text", - itemStar: "sv_q_rating__item-star", - itemStarSelected: "sv_q_rating__item-star--selected", - itemSmiley: "sv_q_rating__item-smiley", - itemSmileySelected: "sv_q_rating__item-smiley--selected", - }, - text: { - root: "sv_q_text_root", - remainingCharacterCounter: "sv-remaining-character-counter", - }, - expression: "", - file: { - root: "sv_q_file", - placeholderInput: "sv-visuallyhidden", - previewItem: "sv_q_file_preview", - removeButton: "sv_q_file_remove_button", - fileInput: "sv-visuallyhidden", - removeFile: "sv_q_file_remove", - fileDecorator: "sv-file__decorator", - fileSign: "sv_q_file_sign", - chooseFile: "sv_q_file_choose_button", - noFileChosen: "sv_q_file_placeholder", - dragAreaPlaceholder: "sv-hidden", - fileList: "", - }, - signaturepad: { - root: "sv_q_signaturepad sjs_sp_container", - controls: "sjs_sp_controls", - placeholder: "sjs_sp_placeholder", - canvas: "sjs_sp_canvas", - backgroundImage: "sjs_sp__background-image", - clearButton: "sjs_sp_clear", - }, - saveData: { - root: "sv-save-data_root", - rootWithButtons: "sv-save-data_root--with-buttons", - info: "sv-save-data_info", - error: "sv-save-data_error", - success: "sv-save-data_success", - button: "sv-save-data_button", - shown: "sv-save-data_root--shown" - }, - window: { - root: "sv_window", - rootCollapsedMod: "sv_window--collapsed", - rootFullScreenMode: "sv_window--full-screen", - rootContent: "sv_window_root-content", - body: "sv_window_content", - header: { - root: "sv_window_header", - titleCollapsed: "sv_window_header_title_collapsed", - buttonsContainer: "sv_window_buttons_container", - button: "sv_window_button", - buttonExpanded: "", - buttonCollapsed: "", - collapseButton: "sv_window_button sv_window_button_collapse", - closeButton: "sv_window_button sv_window_button_close", - fullScreenButton: "sv_window_button sv_window_button_full_screen" - } - }, - variables: { - mobileWidth: "--sv-mobile-width", - themeMark: "--sv-default-mark" - }, - tagbox: { - root: "", - popup: "sv-dropdown-popup", - small: "sv_q_row__question--small", - selectWrapper: "sv_select_wrapper sv_q_tagbox_wrapper", - other: "sv_q_input sv_q_comment sv_q_selectbase__other", - cleanButton: "sv_q_tagbox_clean-button sv_q_dropdown_clean-button", - cleanButtonSvg: "sv_q_tagbox_clean-button-svg sv_q_dropdown_clean-button-svg", - cleanButtonIconId: "icon-clear_16x16", - cleanItemButton: "sv_q_tagbox-item_clean-button", - cleanItemButtonSvg: "sv_q_tagbox-item_clean-button-svg", - cleanItemButtonIconId: "icon-clear_16x16", - control: "sv_q_input sv_q_tagbox sv_q_dropdown_control", - controlValue: "sv_q_tagbox__value sv_q_dropdown__value", - controlEmpty: "sv_q_dropdown--empty sv_q_tagbox--empty", - placeholderInput: "sv_q_tagbox__placeholder", - filterStringInput: "sv_q_tagbox__filter-string-input sv_q_dropdown__filter-string-input", - hint: "sv_q_tagbox__hint", - hintPrefix: "sv_q_dropdown__hint-prefix sv_q_tagbox__hint-prefix", - hintSuffix: "sv_q_dropdown__hint-suffix sv_q_tagbox__hint-suffix", - hintSuffixWrapper: "sv_q_tagbox__hint-suffix-wrapper" - }, -}; - -(surveyCss)["default"] = defaultStandardCss; -(surveyCss)["orange"] = defaultStandardCss; -(surveyCss)["darkblue"] = defaultStandardCss; -(surveyCss)["darkrose"] = defaultStandardCss; -(surveyCss)["stone"] = defaultStandardCss; -(surveyCss)["winter"] = defaultStandardCss; -(surveyCss)["winterstone"] = defaultStandardCss; \ No newline at end of file +import { SurveyModel } from "../src/survey"; +export const oldDefaultTheme = { + root: "sv_main sv_default_css", + rootProgress: "sv_progress", + container: "sv_container", + header: "sv_header", + bodyContainer: "sv-components-row", + body: "sv_body", + bodyEmpty: "sv_body sv_body_empty", + footer: "sv_nav", + title: "", + description: "", + logo: "sv_logo", + logoImage: "sv_logo__image", + headerText: "sv_header__text", + navigationButton: "sv_nav_btn", + completedPage: "sv_completed_page", + navigation: { + complete: "sv_complete_btn", + prev: "sv_prev_btn", + next: "sv_next_btn", + start: "sv_start_btn", + preview: "sv_preview_btn", + edit: "sv_edit_btn", + }, + progress: "sv_progress", + progressBar: "sv_progress_bar", + progressTextInBar: "sv-hidden", + progressButtonsContainerCenter: "sv_progress-buttons__container-center", + progressButtonsContainer: "sv_progress-buttons__container", + progressButtonsImageButtonLeft: "sv_progress-buttons__image-button-left", + progressButtonsImageButtonRight: "sv_progress-buttons__image-button-right", + progressButtonsImageButtonHidden: "sv_progress-buttons__image-button--hidden", + progressButtonsListContainer: "sv_progress-buttons__list-container", + progressButtonsList: "sv_progress-buttons__list", + progressButtonsListElementPassed: "sv_progress-buttons__list-element--passed", + progressButtonsListElementCurrent: + "sv_progress-buttons__list-element--current", + progressButtonsListElementNonClickable: + "sv_progress-buttons__list-element--nonclickable", + progressButtonsPageTitle: "sv_progress-buttons__page-title", + progressButtonsPageDescription: "sv_progress-buttons__page-description", + page: { + root: "sv_p_root", + title: "sv_page_title", + description: "", + }, + // TODO: move to the page object + pageTitle: "sv_page_title", + pageDescription: "", + row: "sv_row", + question: { + mainRoot: "sv_q sv_qstn", + flowRoot: "sv_q_flow sv_qstn", + header: "", + headerLeft: "title-left", + content: "", + contentLeft: "content-left", + titleLeftRoot: "sv_qstn_left", + requiredText: "sv_q_required_text", + title: "sv_q_title", + titleExpandable: "sv_q_title_expandable", + titleExpandableSvg: "sd-element__title-expandable-svg", + titleExpanded: "sv_q_title_expanded", + titleCollapsed: "sv_q_title_collapsed", + number: "sv_q_num", + description: "sv_q_description", + comment: "", + required: "", + titleRequired: "", + hasError: "", + indent: 20, + footer: "sv_q_footer", + formGroup: "form-group", + asCell: "sv_matrix_cell", + icon: "sv_question_icon", + iconExpanded: "sv_expanded", + disabled: "sv_q--disabled", + }, + panel: { + title: "sv_p_title", + titleExpandable: "sv_p_title_expandable", + titleExpandableSvg: "sd-element__title-expandable-svg", + titleExpanded: "sv_p_title_expanded", + titleCollapsed: "sv_p_title_collapsed", + titleOnError: "", + icon: "sv_panel_icon", + iconExpanded: "sv_expanded", + description: "sv_p_description", + container: "sv_p_container", + footer: "sv_p_footer", + number: "sv_q_num", + requiredText: "sv_q_required_text", + }, + error: { + root: "sv_q_erbox", + icon: "", + item: "", + locationTop: "sv_qstn_error_top", + locationBottom: "sv_qstn_error_bottom", + }, + + boolean: { + root: "sv_qcbc sv_qbln", + rootRadio: "sv_qcbc sv_qbln", + item: "sv-boolean", + control: "sv-visuallyhidden", + itemChecked: "sv-boolean--checked checked", + itemIndeterminate: "sv-boolean--indeterminate", + itemDisabled: "sv-boolean--disabled", + switch: "sv-boolean__switch", + slider: "sv-boolean__slider", + label: "sv-boolean__label ", + disabledLabel: "sv-boolean__label--disabled", + sliderGhost: "sv-boolean__thumb-ghost", + //checkbox + rootCheckbox: "sv_qcbc sv_qbln", + checkboxItem: "sv-boolean", + checkboxItemChecked: "sv-boolean--checked", + controlCheckbox: "sv-visuallyvisible", + checkboxControlLabel: "sv-boolean__label", + checkboxItemIndeterminate: "sv-boolean--indeterminate", + checkboxItemDisabled: "sv-item--disabled sv-boolean--disabled", + checkboxMaterialDecorator: "sv-item__decorator sv-boolean__decorator", + checkboxItemDecorator: "sv-item__svg sv-boolean__svg", + }, + checkbox: { + root: "sv_qcbc sv_qcbx", + item: "sv_q_checkbox", + itemSelectAll: "sv_q_checkbox_selectall", + itemNone: "sv_q_checkbox_none", + itemChecked: "checked", + itemInline: "sv_q_checkbox_inline", + label: "sv_q_checkbox_label", + labelChecked: "", + itemControl: "sv_q_checkbox_control_item", + itemDecorator: "sv-hidden", + controlLabel: "sv_q_checkbox_control_label", + other: "sv_q_other sv_q_checkbox_other", + column: "sv_q_select_column", + }, + ranking: { + root: "sv-ranking", + rootMobileMod: "sv-ranking--mobile", + rootDragMod: "sv-ranking--drag", + rootDisabled: "sv-ranking--disabled", + rootDragHandleAreaIcon: "sv-ranking--drag-handle-area-icon", + rootSelectToRankMod: "sv-ranking--select-to-rank", + rootSelectToRankAlignVertical: "sv-ranking--select-to-rank-vertical", + rootSelectToRankAlignHorizontal: "sv-ranking--select-to-rank-horizontal", + rootSelectToRankSwapAreas: "sv-ranking--select-to-rank-swap-areas", + item: "sv-ranking-item", + itemContent: "sv-ranking-item__content", + itemIndex: "sv-ranking-item__index", + itemIndexEmptyMode: "sv-ranking-item__index--empty", + // itemText: "sv-ranking-item__text", + controlLabel: "sv-ranking-item__text", + itemGhostNode: "sv-ranking-item__ghost", + itemIconContainer: "sv-ranking-item__icon-container", + itemIcon: "sv-ranking-item__icon", + itemIconHoverMod: "sv-ranking-item__icon--hover", + itemIconFocusMod: "sv-ranking-item__icon--focus", + itemGhostMod: "sv-ranking-item--ghost", + itemDragMod: "sv-ranking-item--drag", + container: "sv-ranking__container", + containerEmptyMode: "sv-ranking__container--empty", + containerFromMode: "sv-ranking__container--from", + containerToMode: "sv-ranking__container--to", + containerPlaceholder: "sv-ranking__container-placeholder", + containersDivider: "sv-ranking__containers-divider", + }, + comment: { + remainingCharacterCounter: "sv-remaining-character-counter", + }, + dropdown: { + root: "", + popup: "sv-dropdown-popup", + control: "sv_q_dropdown_control", + controlInputFieldComponent: "sv_q_dropdown_control__input-field-component", + selectWrapper: "sv_select_wrapper", + other: "sv_q_dd_other", + cleanButton: "sv_q_dropdown_clean-button", + cleanButtonSvg: "sv_q_dropdown_clean-button-svg", + cleanButtonIconId: "icon-clear_16x16", + controlValue: "sv_q_dropdown__value", + filterStringInput: "sv_q_dropdown__filter-string-input", + hintPrefix: "sv_q_dropdown__hint-prefix", + hintSuffix: "sv_q_dropdown__hint-suffix" + }, + html: { root: "" }, + image: { + root: "sv_q_image", + image: "sv_image_image", + noImage: "sv-image__no-image", + noImageSvgIconId: "icon-no-image", + }, + matrix: { + root: "sv_q_matrix", + label: "sv_q_m_label", + itemChecked: "checked", + itemDecorator: "sv-hidden", + cell: "sv_q_m_cell", + cellText: "sv_q_m_cell_text", + cellTextSelected: "sv_q_m_cell_selected", + cellLabel: "sv_q_m_cell_label", + cellResponsiveTitle: "sv_q_m_cell_responsive_title" + }, + matrixdropdown: { + root: "sv_q_matrix_dropdown", + cell: "sv_matrix_cell", + cellResponsiveTitle: "sv_matrix_cell_responsive_title", + headerCell: "sv_matrix_cell_header", + row: "sv_matrix_row", + rowAdditional: "sv-matrix__row--additional", + rowTextCell: "sv-table__cell--row-text", + detailRow: "sv_matrix_detail_row", + detailRowText: "sv_matrix_cell_detail_rowtext", + detailCell: "sv_matrix_cell_detail", + choiceCell: "sv-table__cell--choice", + detailButton: "sv_matrix_cell_detail_button", + detailButtonExpanded: "sv_matrix_cell_detail_button_expanded", + detailIcon: "sv_detail_panel_icon", + detailIconExpanded: "sv_detail_expanded", + detailPanelCell: "sv_matrix_cell_detail_panel", + actionsCell: "sv_matrix_cell sv_matrix_cell_actions", + }, + matrixdynamic: { + root: "sv_q_matrix_dynamic", + button: "sv_matrix_dynamic_button", + buttonAdd: "sv_matrix_dynamic_button--add", + buttonRemove: "", + iconAdd: "", + iconRemove: "", + iconDrag: "sv-matrixdynamic__drag-icon", + cell: "sv_matrix_cell", + cellResponsiveTitle: "sv_matrix_cell_responsive_title", + headerCell: "sv_matrix_cell_header", + row: "sv_matrix_row", + detailRow: "sv_matrix_detail_row", + detailCell: "sv_matrix_cell_detail", + choiceCell: "sv-table__cell--choice", + detailButton: "sv_matrix_cell_detail_button", + detailButtonExpanded: "sv_matrix_cell_detail_button_expanded", + detailIcon: "sv_detail_panel_icon", + detailIconExpanded: "sv_detail_expanded", + detailPanelCell: "sv_matrix_cell_detail_panel", + actionsCell: "sv_matrix_cell sv_matrix_cell_actions", + emptyRowsSection: "sv_matrix_empty_rows_section", + emptyRowsText: "sv_matrix_empty_rows_text", + emptyRowsButton: "", + ghostRow: "sv-matrix-row--drag-drop-ghost-mod", + draggedRow: "sv-matrixdynamic-dragged-row" + }, + paneldynamic: { + root: "sv_panel_dynamic", + title: "sv_p_title", + header: "sv-paneldynamic__header sv_header", + headerTab: "sv-paneldynamic__header-tab", + button: "", + buttonAdd: "sv-paneldynamic__add-btn", + buttonRemove: "sv_p_remove_btn", + buttonRemoveRight: "sv_p_remove_btn_right", + buttonPrev: "sv-paneldynamic__prev-btn", + buttonPrevDisabled: "sv-paneldynamic__prev-btn--disabled", + buttonNextDisabled: "sv-paneldynamic__next-btn--disabled", + buttonNext: "sv-paneldynamic__next-btn", + progressContainer: "sv-paneldynamic__progress-container", + progress: "sv-progress", + progressBar: "sv-progress__bar", + progressText: "sv-paneldynamic__progress-text", + panelWrapper: "sv_p_wrapper", + panelWrapperInRow: "sv_p_wrapper_in_row", + footer: "", + progressBtnIcon: "icon-progressbutton" + }, + multipletext: { + root: "sv_q_mt", + itemTitle: "sv_q_mt_title", + item: "sv_q_mt_item", + row: "sv_q_mt_row", + itemLabel: "sv_q_mt_label", + itemValue: "sv_q_mt_item_value sv_q_text_root", + }, + radiogroup: { + root: "sv_qcbc", + item: "sv_q_radiogroup", + itemChecked: "checked", + itemInline: "sv_q_radiogroup_inline", + itemDecorator: "sv-hidden", + label: "sv_q_radiogroup_label", + labelChecked: "", + itemControl: "sv_q_radiogroup_control_item", + controlLabel: "", + other: "sv_q_other sv_q_radiogroup_other", + clearButton: "sv_q_radiogroup_clear", + column: "sv_q_select_column", + }, + buttongroup: { + root: "sv-button-group", + item: "sv-button-group__item", + itemIcon: "sv-button-group__item-icon", + itemDecorator: "sv-button-group__item-decorator", + itemCaption: "sv-button-group__item-caption", + itemHover: "sv-button-group__item--hover", + itemSelected: "sv-button-group__item--selected", + itemDisabled: "sv-button-group__item--disabled", + itemControl: "sv-visuallyhidden", + }, + imagepicker: { + root: "sv_imgsel", + item: "sv_q_imgsel", + itemChecked: "checked", + label: "sv_q_imgsel_label", + itemControl: "sv_q_imgsel_control_item", + image: "sv_q_imgsel_image", + itemInline: "sv_q_imagepicker_inline", + itemText: "sv_q_imgsel_text", + clearButton: "sv_q_radiogroup_clear", + column: "sv_q_select_column", + itemNoImage: "sv_q_imgsel__no-image", + itemNoImageSvgIcon: "sv_q_imgsel__no-image-svg", + itemNoImageSvgIconId: "icon-no-image", + }, + rating: { + root: "sv_q_rating", + item: "sv_q_rating_item", + itemFixedSize: "sv_q_rating_item_fixed", + selected: "active", + minText: "sv_q_rating_min_text", + itemText: "sv_q_rating_item_text", + maxText: "sv_q_rating_max_text", + itemStar: "sv_q_rating__item-star", + itemStarSelected: "sv_q_rating__item-star--selected", + itemSmiley: "sv_q_rating__item-smiley", + itemSmileySelected: "sv_q_rating__item-smiley--selected", + }, + text: { + root: "sv_q_text_root", + remainingCharacterCounter: "sv-remaining-character-counter", + }, + expression: "", + file: { + root: "sv_q_file", + placeholderInput: "sv-visuallyhidden", + previewItem: "sv_q_file_preview", + removeButton: "sv_q_file_remove_button", + fileInput: "sv-visuallyhidden", + removeFile: "sv_q_file_remove", + fileDecorator: "sv-file__decorator", + fileSign: "sv_q_file_sign", + chooseFile: "sv_q_file_choose_button", + noFileChosen: "sv_q_file_placeholder", + dragAreaPlaceholder: "sv-hidden", + fileList: "", + }, + signaturepad: { + root: "sv_q_signaturepad sjs_sp_container", + controls: "sjs_sp_controls", + placeholder: "sjs_sp_placeholder", + canvas: "sjs_sp_canvas", + backgroundImage: "sjs_sp__background-image", + clearButton: "sjs_sp_clear", + }, + saveData: { + root: "sv-save-data_root", + rootWithButtons: "sv-save-data_root--with-buttons", + info: "sv-save-data_info", + error: "sv-save-data_error", + success: "sv-save-data_success", + button: "sv-save-data_button", + shown: "sv-save-data_root--shown" + }, + window: { + root: "sv_window", + rootCollapsedMod: "sv_window--collapsed", + rootFullScreenMode: "sv_window--full-screen", + rootContent: "sv_window_root-content", + body: "sv_window_content", + header: { + root: "sv_window_header", + titleCollapsed: "sv_window_header_title_collapsed", + buttonsContainer: "sv_window_buttons_container", + button: "sv_window_button", + buttonExpanded: "", + buttonCollapsed: "", + collapseButton: "sv_window_button sv_window_button_collapse", + closeButton: "sv_window_button sv_window_button_close", + fullScreenButton: "sv_window_button sv_window_button_full_screen" + } + }, + variables: { + mobileWidth: "--sv-mobile-width", + themeMark: "--sv-default-mark" + }, + tagbox: { + root: "", + popup: "sv-dropdown-popup", + small: "sv_q_row__question--small", + selectWrapper: "sv_select_wrapper sv_q_tagbox_wrapper", + other: "sv_q_input sv_q_comment sv_q_selectbase__other", + cleanButton: "sv_q_tagbox_clean-button sv_q_dropdown_clean-button", + cleanButtonSvg: "sv_q_tagbox_clean-button-svg sv_q_dropdown_clean-button-svg", + cleanButtonIconId: "icon-clear_16x16", + cleanItemButton: "sv_q_tagbox-item_clean-button", + cleanItemButtonSvg: "sv_q_tagbox-item_clean-button-svg", + cleanItemButtonIconId: "icon-clear_16x16", + control: "sv_q_input sv_q_tagbox sv_q_dropdown_control", + controlValue: "sv_q_tagbox__value sv_q_dropdown__value", + controlEmpty: "sv_q_dropdown--empty sv_q_tagbox--empty", + placeholderInput: "sv_q_tagbox__placeholder", + filterStringInput: "sv_q_tagbox__filter-string-input sv_q_dropdown__filter-string-input", + hint: "sv_q_tagbox__hint", + hintPrefix: "sv_q_dropdown__hint-prefix sv_q_tagbox__hint-prefix", + hintSuffix: "sv_q_dropdown__hint-suffix sv_q_tagbox__hint-suffix", + hintSuffixWrapper: "sv_q_tagbox__hint-suffix-wrapper" + }, +}; + +export function setOldTheme(survey: SurveyModel) { + survey["cssValue"] = {}; + survey.css = oldDefaultTheme; +} \ No newline at end of file diff --git a/packages/survey-core/tests/paneltests.ts b/packages/survey-core/tests/paneltests.ts index d20570d85d..6debea4e42 100644 --- a/packages/survey-core/tests/paneltests.ts +++ b/packages/survey-core/tests/paneltests.ts @@ -11,9 +11,8 @@ import { settings } from "../src/settings"; import { AdaptiveActionContainer } from "../src/actions/adaptive-container"; import { ActionContainer } from "../src/actions/container"; import { IElement } from "../src/base-interfaces"; -import { StylesManager } from "@legacy/stylesmanager"; import { SurveyElement } from "../src/survey-element"; - +import { setOldTheme } from "./oldTheme"; export default QUnit.module("Panel"); QUnit.test("questions-elements synhronization", function (assert) { @@ -689,8 +688,8 @@ QUnit.test("Do not generate rows and do not set renderWidth", function (assert) assert.equal(q.renderWidth, "", "render width is empty"); }); QUnit.test("question.cssRoot class", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel(); + setOldTheme(survey); const page = survey.addNewPage("p"); const flowPanel = new FlowPanelModel("flowPanel"); page.addElement(flowPanel); @@ -908,7 +907,7 @@ QUnit.test("Panel.startLazyRendering isNeedRender=true", function (assert) { try { settings.lazyRowsRenderingStartRow = 0; const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const panel: PanelModel = survey.getAllPanels()[0]; const page = survey.currentPage; assert.equal(panel.rows.length, 2); @@ -1029,7 +1028,7 @@ QUnit.test("row.isNeedRender & settings.lazyRowsRenderingStartRow", function ( settings.lazyRowsRenderingStartRow = 2; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page: PageModel = survey.currentPage; assert.equal(page.rows.length, 3, "There are 3 rows"); assert.equal(page.rows[0].isNeedRender, true, "isNeedRender rows[0]"); @@ -1079,7 +1078,7 @@ QUnit.test( settings.lazyRowsRenderingStartRow = 2; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; survey.setDesignMode(true); const page1: PageModel = survey.pages[0]; assert.equal(page1.rows.length, 3, "There are 3 rows"); @@ -1675,7 +1674,7 @@ QUnit.test( settings.lazyRowsRenderingStartRow = 2; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; assert.equal(page1.rows.length, 3, "There are 3 rows"); assert.equal(page1.rows[0].isNeedRender, true, "isNeedRender rows[0]"); @@ -2902,7 +2901,7 @@ QUnit.test("row.isNeedRender for panels", function (assert) { settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; assert.equal(page1.rows.length, 2, "There are 2 rows"); assert.equal(page1.rows[0].isNeedRender, true, "isNeedRender page1 rows[0]"); @@ -2950,7 +2949,7 @@ QUnit.test("getAllRows for page", function (assert) { settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; const allPageRows = page1.getAllRows(); @@ -2998,7 +2997,7 @@ QUnit.test("forceRenderRows for page", async function (assert) { settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; survey.getAllQuestions().forEach(q => { q.supportOnElementRerenderedEvent = true; q.onElementRerenderedEventEnabled = true; @@ -3059,7 +3058,7 @@ QUnit.test("forceRenderElement for page the exact element, gap = 0", async funct settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; survey.getAllQuestions().forEach(q => { q.supportOnElementRerenderedEvent = true; q.onElementRerenderedEventEnabled = true; @@ -3119,7 +3118,7 @@ QUnit.test("forceRenderElement for page with one prev element, gap = 1", async f settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; survey.getAllQuestions().forEach(q => { q.supportOnElementRerenderedEvent = true; q.onElementRerenderedEventEnabled = true; @@ -3195,7 +3194,7 @@ QUnit.test("row.isNeedRender for nested panels", function (assert) { settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; const allPageRows = page1.getAllRows(); assert.equal(allPageRows.length, 7, "7 rows with panels"); @@ -3279,7 +3278,7 @@ QUnit.test("row.isNeedRender for nested panels - complex", function (assert) { settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; const allPageRows = page1.getAllRows(); assert.equal(allPageRows.length, 7, "7 rows with panels"); @@ -3343,7 +3342,7 @@ QUnit.test("row.isNeedRender panel dynamic different modes - ordinary and design settings.lazyRowsRenderingStartRow = 0; try { const survey = new SurveyModel(json); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; const page1: PageModel = survey.pages[0]; let allPageRows = page1.getAllRows(); diff --git a/packages/survey-core/tests/questionFileTests.ts b/packages/survey-core/tests/questionFileTests.ts index 570e79688f..3335ffb380 100644 --- a/packages/survey-core/tests/questionFileTests.ts +++ b/packages/survey-core/tests/questionFileTests.ts @@ -3,7 +3,6 @@ import { QuestionFileModel } from "../src/question_file"; import { QuestionPanelDynamicModel } from "../src/question_paneldynamic"; import { getLocaleString } from "../src/surveyStrings"; import { settings } from "../src/settings"; -import { StylesManager } from "@legacy/stylesmanager"; import { Serializer } from "../src/jsonobject"; import { Camera } from "../src/utils/camera"; import { defaultV2Css } from "../src/defaultCss/defaultV2Css"; @@ -1402,7 +1401,6 @@ QUnit.test("QuestionFile download file content on preview, #2", function (assert }); QUnit.test("QuestionFile current mode property, camera is not available", function (assert) { - StylesManager.applyTheme("defaultV2"); const callbacks = new Array<(devices: Array) => void>(); Camera.mediaDevicesCallback = (cb: (devices: Array) => void): void => { callbacks.push(cb); @@ -1432,7 +1430,6 @@ QUnit.test("QuestionFile current mode property, camera is not available", functi callbacks.forEach(cb => cb([])); assert.equal(survey.getQuestionByName("q1").currentMode, "file", "#6"); Camera.mediaDevicesCallback = undefined; - StylesManager.applyTheme("default"); }); function createDevices(info: Array): Array { const res = new Array(); @@ -1444,7 +1441,6 @@ function createDevices(info: Array): Array { return res; } QUnit.test("QuestionFile current mode property, camera is available", function (assert) { - StylesManager.applyTheme("defaultV2"); const callbacks = new Array<(devices: Array) => void>(); Camera.mediaDevicesCallback = (cb: (devices: Array) => void): void => { callbacks.push(cb); @@ -1476,10 +1472,8 @@ QUnit.test("QuestionFile current mode property, camera is available", function ( callbacks.forEach(cb => cb(devices)); assert.equal(survey.getQuestionByName("q1").currentMode, "camera", "#6"); Camera.mediaDevicesCallback = undefined; - StylesManager.applyTheme("default"); }); QUnit.test("QuestionFile check file actions visibility when camera is available from start point", function (assert) { - StylesManager.applyTheme("defaultV2"); Camera.setCameraList([{ label: "test" }]); let survey = new SurveyModel({ elements: [ @@ -1500,7 +1494,6 @@ QUnit.test("QuestionFile check file actions visibility when camera is available assert.ok(survey.getQuestionByName("q3").actionsContainer.actions[0].visible); assert.ok(survey.getQuestionByName("q3").actionsContainer.actions[1].visible); Camera.clear(); - StylesManager.applyTheme("default"); }); QUnit.test("new Camera().getMediaConstraints", function (assert) { Camera.setCameraList(createDevices([{ label: "dfdf" }, { label: "user" }])); diff --git a/packages/survey-core/tests/questionImagepicker.ts b/packages/survey-core/tests/questionImagepicker.ts index 651bed9895..43ee44e13f 100644 --- a/packages/survey-core/tests/questionImagepicker.ts +++ b/packages/survey-core/tests/questionImagepicker.ts @@ -1,6 +1,7 @@ import { SurveyModel } from "../src/survey"; import { ImageItemValue, QuestionImagePickerModel } from "../src/question_imagepicker"; import { defaultV2Css } from "../src/defaultCss/defaultV2Css"; +import { setOldTheme } from "./oldTheme"; export default QUnit.module("imagepicker"); @@ -77,6 +78,7 @@ QUnit.test("check dependency getItemClass method on colCount", function ( assert ) { let survey = new SurveyModel({}); + setOldTheme(survey); let page = survey.addNewPage(); let question = page.addNewQuestion("imagepicker"); question.choices = [{ value: "item1" }, { value: "item2" }]; diff --git a/packages/survey-core/tests/question_baseselecttests.ts b/packages/survey-core/tests/question_baseselecttests.ts index 35fbfd8c68..67b23383ae 100644 --- a/packages/survey-core/tests/question_baseselecttests.ts +++ b/packages/survey-core/tests/question_baseselecttests.ts @@ -11,6 +11,7 @@ import { IAction } from "../src/actions/action"; import { surveyLocalization } from "../src/surveyStrings"; import { Base } from "../src/base"; import { QuestionMatrixDynamicModel } from "../src/question_matrixdynamic"; +import { setOldTheme } from "./oldTheme"; export default QUnit.module("baseselect"); @@ -862,6 +863,7 @@ QUnit.test("check radiogroup title actions", (assert) => { showClearButton: true }] }); + setOldTheme(survey); let question = survey.getAllQuestions()[0]; assert.deepEqual(question.getTitleActions(), []); assert.ok(question.showClearButtonInContent); diff --git a/packages/survey-core/tests/question_customtests.ts b/packages/survey-core/tests/question_customtests.ts index 450fe3e80a..1b19ef5093 100644 --- a/packages/survey-core/tests/question_customtests.ts +++ b/packages/survey-core/tests/question_customtests.ts @@ -14,10 +14,10 @@ import { QuestionPanelDynamicModel } from "../src/question_paneldynamic"; import { ItemValue } from "../src/itemvalue"; import { LocalizableString } from "../src/localizablestring"; import { PanelModel } from "../src/panel"; -import { StylesManager } from "@legacy/stylesmanager"; import { ArrayChanges, Base } from "../src/base"; import { QuestionFileModel } from "../src/question_file"; import { ConsoleWarnings } from "../src/console-warnings"; +import { setOldTheme } from "./oldTheme"; export default QUnit.module("custom questions"); @@ -435,8 +435,8 @@ QUnit.test("Composite: onPropertyChanged", function (assert) { ComponentCollection.Instance.clear(); }); QUnit.test("Custom, get css from contentQuestion", function (assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel(); + setOldTheme(survey); survey.css.dropdown.small = "small"; survey.css.dropdown.title = "title"; survey.css.question.titleOnAnswer = "onAnswer"; @@ -483,8 +483,8 @@ QUnit.test("Custom, get css from contentQuestion", function (assert) { ComponentCollection.Instance.clear(); }); QUnit.test("Composite, update panel css", function (assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel(); + setOldTheme(survey); survey.css.question.small = "small"; survey.css.question.title = "title"; survey.css.question.titleOnAnswer = "onAnswer"; @@ -1896,7 +1896,6 @@ QUnit.test("Check updateElementCss for custom question", function (assert) { name: "newquestion", questionJSON: { type: "text" }, }; - StylesManager.applyTheme("default"); ComponentCollection.Instance.add(json); var survey = new SurveyModel({ elements: [{ type: "newquestion", name: "q1" }], diff --git a/packages/survey-core/tests/question_matrixdropdownbasetests.ts b/packages/survey-core/tests/question_matrixdropdownbasetests.ts index eb94cbd32a..33c5713f28 100644 --- a/packages/survey-core/tests/question_matrixdropdownbasetests.ts +++ b/packages/survey-core/tests/question_matrixdropdownbasetests.ts @@ -10,6 +10,7 @@ import { QuestionMatrixDropdownModel } from "../src/question_matrixdropdown"; import { QuestionCheckboxModel } from "../src/question_checkbox"; import { ItemValue } from "../src/itemvalue"; import { settings } from "../src/settings"; +import { setOldTheme } from "./oldTheme"; export * from "../src/localization/german"; export default QUnit.module("Survey_QuestionMatrixDropdownBase"); @@ -84,6 +85,7 @@ QUnit.test("table vertical align and alternate rows", function (assert) { }, ], }); + setOldTheme(survey); const matrix = survey.getQuestionByName("matrix"); @@ -229,7 +231,7 @@ QUnit.test("column cell css classes by column cellType test", function (assert) } ] }); - + setOldTheme(survey); const matrix = survey.getQuestionByName("matrix"); assert.equal(matrix.renderedTable.headerRow.cells.length, 6); assert.equal(matrix.renderedTable.headerRow.cells[0].className, "sv_matrix_cell_header sv_matrix_cell--dropdown", "empty column"); @@ -350,7 +352,7 @@ QUnit.test("column cell css classes by matrix cellType test", function (assert) } ] }); - + setOldTheme(survey); const matrix = survey.getQuestionByName("matrix"); assert.equal(matrix.renderedTable.headerRow.cells.length, 6); assert.equal(matrix.renderedTable.headerRow.cells[0].className, "sv_matrix_cell_header sv_matrix_cell--dropdown", "empty column"); @@ -452,6 +454,7 @@ QUnit.test("Check matrixdropdown cells cssClasses with showInMultipleColumns", f }, ], }); + setOldTheme(survey); survey.css = { matrixdropdown: { headerCell: "custom-header-cell", diff --git a/packages/survey-core/tests/question_matrixdynamictests.ts b/packages/survey-core/tests/question_matrixdynamictests.ts index e4e62ea1cf..b18198d2ab 100644 --- a/packages/survey-core/tests/question_matrixdynamictests.ts +++ b/packages/survey-core/tests/question_matrixdynamictests.ts @@ -20,7 +20,7 @@ import { Action } from "../src/actions/action"; import { MatrixDropdownColumn, matrixDropdownColumnTypes } from "../src/question_matrixdropdowncolumn"; import { QuestionMatrixDropdownRenderedErrorRow, QuestionMatrixDropdownRenderedRow } from "../src/question_matrixdropdownrendered"; import { AnimationGroup } from "../src/utils/animation"; - +import { setOldTheme } from "./oldTheme"; export default QUnit.module("Survey_QuestionMatrixDynamic"); QUnit.test("Matrixdropdown cells tests", function (assert) { @@ -7244,6 +7244,7 @@ QUnit.test("Detail panel, rendered table and className", function (assert) { }, ], }); + setOldTheme(survey); var matrix = survey.getQuestionByName("matrix"); matrix.visibleRows[0].showDetailPanel(); assert.equal(matrix.renderedTable.headerRow.cells[1].className, "sv_matrix_cell_header sv_matrix_cell--dropdown", "Set header cell"); @@ -7573,6 +7574,7 @@ QUnit.test("Row actions, rendered table and className", function (assert) { }, ], }); + setOldTheme(survey); survey.onGetMatrixRowActions.add((_, opt) => { opt.actions = [ { title: "Action 1" }, diff --git a/packages/survey-core/tests/question_multipletexttests.ts b/packages/survey-core/tests/question_multipletexttests.ts index caf013970e..b7fbe7cc3f 100644 --- a/packages/survey-core/tests/question_multipletexttests.ts +++ b/packages/survey-core/tests/question_multipletexttests.ts @@ -242,7 +242,7 @@ QUnit.test("defaultValueExpression executing", (assert) => { q1.items[1].value = 5; assert.equal(q1.items[2].editor.value, 15, "Calculated correctly"); }); -QUnit.test("Make itemSize invisible by default", (assert) => { - const prop = Serializer.findProperty("multipletext", "itemSize"); +QUnit.test("Make inputSize invisible by default", (assert) => { + const prop = Serializer.findProperty("multipletext", "inputSize"); assert.strictEqual(prop.visible, false); }); \ No newline at end of file diff --git a/packages/survey-core/tests/question_paneldynamic_tests.ts b/packages/survey-core/tests/question_paneldynamic_tests.ts index 58d6f36c99..4de64f529d 100644 --- a/packages/survey-core/tests/question_paneldynamic_tests.ts +++ b/packages/survey-core/tests/question_paneldynamic_tests.ts @@ -14,13 +14,11 @@ import { QuestionFileModel } from "../src/question_file"; import { QuestionDropdownModel } from "../src/question_dropdown"; import { defaultV2Css } from "../src/defaultCss/defaultV2Css"; import { ItemValue } from "../src/itemvalue"; -import { StylesManager } from "@legacy/stylesmanager"; import { settings } from "../src/settings"; import { QuestionMatrixModel } from "../src/question_matrix"; -import { defaultStandardCss } from "@legacy/defaultCss/cssstandard"; import { AnimationGroup, AnimationTab } from "../src/utils/animation"; import { SurveyElement } from "../src/survey-element"; - +import { setOldTheme } from "./oldTheme"; export default QUnit.module("Survey_QuestionPanelDynamic"); QUnit.test("Create panels based on template on setting value", function( @@ -2814,7 +2812,7 @@ QUnit.test( } ); -QUnit.test("Test defaultValueFromLastPanel property", function(assert) { +QUnit.test("Test copyDefaultValueFromLastEntry property", function(assert) { var survey = new SurveyModel(); var page = survey.addNewPage("page"); var question = ( @@ -2824,7 +2822,7 @@ QUnit.test("Test defaultValueFromLastPanel property", function(assert) { question.template.addNewQuestion("text", "q1"); question.template.addNewQuestion("text", "q2"); question.template.addNewQuestion("text", "q3"); - question.defaultValueFromLastPanel = true; + question.copyDefaultValueFromLastEntry = true; question.addPanel(); assert.equal(question.isEmpty(), true, "It is empty"); question.value = [{ q1: 1, q2: 2 }]; @@ -2835,7 +2833,7 @@ QUnit.test("Test defaultValueFromLastPanel property", function(assert) { { q1: 1, q2: 2 }, { q1: 1, q2: 2 }, ], - "defaultValueFromLastPanel is working" + "copyDefaultValueFromLastEntry is working" ); question.defaultPanelValue = { q1: 11, q3: 3 }; question.addPanel(); @@ -2849,7 +2847,7 @@ QUnit.test("Test defaultValueFromLastPanel property", function(assert) { "defaultValueFromLastRow is merging with defaultPanelValue" ); }); -QUnit.test("defaultValueFromLastPanel property && hasOther", function(assert) { +QUnit.test("copyDefaultValueFromLastEntry property && hasOther", function(assert) { const survey = new SurveyModel({ elements: [ { type: "paneldynamic", name: "root", @@ -4111,11 +4109,13 @@ QUnit.test( ], }; var survey = new SurveyModel(json); - + setOldTheme(survey); var panel = ( survey.getQuestionByName("dynamic_panel") ); + panel.panels[0].rows[0]["setWidth"](panel.panels[0].rows[0].visibleElements); assert.equal((panel.panels[0].elements[0]).paddingRight, "20px"); + panel.panels[1].rows[0]["setWidth"](panel.panels[0].rows[0].visibleElements); assert.equal((panel.panels[1].elements[0]).paddingRight, "20px"); panel.panelCount++; assert.equal((panel.panels[2].elements[0]).paddingRight, "20px"); @@ -4387,7 +4387,6 @@ QUnit.test("Avoid stack-overflow", function(assert) { }); QUnit.test("getPanelWrapperCss", function(assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel({ elements: [ { @@ -4398,7 +4397,7 @@ QUnit.test("getPanelWrapperCss", function(assert) { }, ], }); - + setOldTheme(survey); const question = survey.getQuestionByName("panel"); const panel = question.panels[0]; assert.equal( @@ -4414,7 +4413,6 @@ QUnit.test("getPanelWrapperCss", function(assert) { ); }); QUnit.test("getPanelWrapperCss & templateVisibleIf", function(assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel({ elements: [ { @@ -4426,7 +4424,7 @@ QUnit.test("getPanelWrapperCss & templateVisibleIf", function(assert) { }, ], }); - + setOldTheme(survey); const question = survey.getQuestionByName("panel"); assert.equal(question.panels[0].isVisible, false, "The firt panel is not visible"); assert.equal(question.getPanelWrapperCss(question.panels[0]), "", "panel invisible"); @@ -4436,7 +4434,6 @@ QUnit.test("getPanelWrapperCss & templateVisibleIf", function(assert) { }); QUnit.test("getPanelRemoveButtonCss", function(assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel({ elements: [ { @@ -4446,7 +4443,7 @@ QUnit.test("getPanelRemoveButtonCss", function(assert) { }, ], }); - + setOldTheme(survey); var question = survey.getQuestionByName("panel"); assert.equal( question.getPanelRemoveButtonCss(), @@ -5887,7 +5884,6 @@ QUnit.test("renderMode: tab check hasAdditionalTitleToolbar property", function }); QUnit.test("question.cssHeader class", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [ { @@ -5899,6 +5895,7 @@ QUnit.test("question.cssHeader class", function (assert) { } ], }); + setOldTheme(survey); const panel = survey.getQuestionByName("relatives"); assert.equal(panel.cssHeader, "sv-paneldynamic__header sv_header"); @@ -5947,7 +5944,6 @@ QUnit.test("renderMode: tab & silent validation, Bug#8752", function (assert) { }); QUnit.test("question.hasTitleOnLeftTop class", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [ { @@ -6800,7 +6796,6 @@ QUnit.test("nested panel.panelCount&expression question", function (assert) { }); QUnit.test("Footer css for nested panels", function(assert) { const footerCss = "abcd"; - defaultStandardCss.paneldynamic["panelFooter"] = footerCss; const survey = new SurveyModel({ questions: [ { @@ -6819,13 +6814,18 @@ QUnit.test("Footer css for nested panels", function(assert) { }, ], }); + setOldTheme(survey); + survey.css = { + panel: { + footer: footerCss + } + }; const question = survey.getQuestionByName("q"); assert.equal(question.panels[0].getFooterToolbar().containerCss, footerCss, "root footer container css"); const nested = question.panels[0].getQuestionByName("qq"); assert.equal(nested.panels[0].getFooterToolbar().containerCss, footerCss, "nested footer container css on loading"); nested.addPanel(); assert.equal(nested.panels[1].getFooterToolbar().containerCss, footerCss, "nested footer container css on creating"); - delete defaultStandardCss.paneldynamic["panelFooter"]; }); QUnit.test("question.resetValueIf, basic functionality", function (assert) { const survey = new SurveyModel({ diff --git a/packages/survey-core/tests/question_ratingtests.ts b/packages/survey-core/tests/question_ratingtests.ts index 3fc7a9f4fb..5ea29f1223 100644 --- a/packages/survey-core/tests/question_ratingtests.ts +++ b/packages/survey-core/tests/question_ratingtests.ts @@ -9,11 +9,10 @@ import { ItemValue } from "../src/itemvalue"; import { QuestionMatrixDropdownModel } from "../src/question_matrixdropdown"; import { settings } from "../src/settings"; import { _setIsTouch } from "../src/utils/devices"; -import { StylesManager } from "@legacy/stylesmanager"; import { PopupModel } from "../src/popup"; +import { setOldTheme } from "./oldTheme"; QUnit.test("check allowhover class in design mode", (assert) => { - // StylesManager.applyTheme("default"); var json = { questions: [ { @@ -258,7 +257,6 @@ QUnit.test("Do not process responsiveness if displayMode: 'dropdown' and set ren container.remove(); }); QUnit.test("check getItemClass in display mode", (assert) => { - StylesManager.applyTheme("default"); var json = { questions: [ { @@ -378,7 +376,6 @@ QUnit.test("Check dropdownListModel isItemSelected works correctly", (assert) => }); QUnit.test("check stars highlighting", (assert) => { - StylesManager.applyTheme("default"); var json = { questions: [ { @@ -389,6 +386,7 @@ QUnit.test("check stars highlighting", (assert) => { ], }; const survey = new SurveyModel(json); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); q1.cssClasses.itemStar = ""; q1.cssClasses.itemStarHighlighted = "sv_q_high"; @@ -434,7 +432,6 @@ QUnit.test("check stars highlighting", (assert) => { }); QUnit.test("check stars highlighting design mode", (assert) => { - StylesManager.applyTheme("default"); var json = { questions: [ { @@ -466,7 +463,6 @@ QUnit.test("check stars highlighting design mode", (assert) => { }); QUnit.test("check stars highlighting on touch device", (assert) => { - StylesManager.applyTheme("default"); var json = { questions: [ { @@ -500,7 +496,6 @@ QUnit.test("check stars highlighting on touch device", (assert) => { }); QUnit.test("check stars styles", (assert) => { - StylesManager.applyTheme("default"); var json = { questions: [ { @@ -511,6 +506,7 @@ QUnit.test("check stars styles", (assert) => { ], }; const survey = new SurveyModel(json); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); q1.cssClasses.itemStar = ""; q1.cssClasses.itemStarHighlighted = "sv_q_high"; @@ -534,7 +530,7 @@ QUnit.test("check stars styles", (assert) => { }); QUnit.test("check smiley styles", (assert) => { - StylesManager.applyTheme("default"); + var json = { questions: [ { @@ -582,7 +578,6 @@ QUnit.test("check smiley styles", (assert) => { }); QUnit.test("check stars for rateValues", (assert) => { - StylesManager.applyTheme("default"); var json = { elements: [ { @@ -599,6 +594,7 @@ QUnit.test("check stars for rateValues", (assert) => { }] }; const survey = new SurveyModel(json); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); q1.cssClasses.itemStar = ""; q1.cssClasses.itemStarHighlighted = "sv_q_high"; @@ -682,7 +678,7 @@ QUnit.test("check smileys for min/max", (assert) => { }); QUnit.test("check smileys styles", (assert) => { - StylesManager.applyTheme("default"); + var json = { questions: [ { @@ -693,6 +689,7 @@ QUnit.test("check smileys styles", (assert) => { ], }; const survey = new SurveyModel(json); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); q1.cssClasses.itemSmiley = ""; q1.cssClasses.itemSmileySelected = "sv_q_selected"; @@ -742,7 +739,7 @@ QUnit.test("rating smileys max item count", (assert) => { }); QUnit.test("check fixed width styles", (assert) => { - StylesManager.applyTheme("default"); + var json = { questions: [ { @@ -770,7 +767,7 @@ QUnit.test("check fixed width styles", (assert) => { }); QUnit.test("check fixed width styles - rate values", (assert) => { - StylesManager.applyTheme("default"); + var json = { questions: [ { @@ -1369,7 +1366,7 @@ QUnit.test("rating colors when vars used", (assert) => { }); QUnit.test("check rating in-matrix mode styles", (assert) => { - StylesManager.applyTheme("default"); + var json = { elements: [ { @@ -1431,7 +1428,7 @@ QUnit.test("check rating in-matrix mode styles", (assert) => { }); QUnit.test("check rating in-matrix mode styles", (assert) => { - StylesManager.applyTheme("default"); + const survey = new SurveyModel({ questions: [{ type: "rating", name: "q1" }] }); const q1 = survey.getQuestionByName("q1") as QuestionRatingModel; q1.cssClasses.root = "sv_q"; @@ -1444,7 +1441,7 @@ QUnit.test("check rating in-matrix mode styles", (assert) => { }); QUnit.test("check rating display-mode styles", (assert) => { - StylesManager.applyTheme("default"); + const survey = new SurveyModel({ questions: [{ type: "rating", name: "q1" }] }); const q1 = survey.getQuestionByName("q1") as QuestionRatingModel; q1.cssClasses.root = "sv_q-root"; diff --git a/packages/survey-core/tests/question_texttests.ts b/packages/survey-core/tests/question_texttests.ts index eb21c11ac7..90294be988 100644 --- a/packages/survey-core/tests/question_texttests.ts +++ b/packages/survey-core/tests/question_texttests.ts @@ -3,7 +3,6 @@ import { QuestionCommentModel } from "../src/question_comment"; import { SurveyModel } from "../src/survey"; import { QuestionTextBase, CharacterCounter } from "../src/question_textbase"; import { settings } from "../src/settings"; -import { StylesManager } from "@legacy/stylesmanager"; import { InputMaskPattern } from "../src/mask/mask_pattern"; import { FunctionFactory } from "../src/functionsfactory"; export * from "../src/localization/german"; @@ -380,7 +379,6 @@ QUnit.test("CharacterCounter + settings.showMaxLengthIndicator", function(assert assert.equal(ch.remainingCharacterCounter, "4/7", "#4"); }); QUnit.test("getControlClass with characterCounter", function(assert) { - StylesManager.applyTheme("defaultV2"); const inputClasses = "sd-input sd-text"; const constrolWithCharacterCounter = "sd-text__character-counter"; const characterCounterBig = "sd-text__character-counter--big"; @@ -394,7 +392,6 @@ QUnit.test("getControlClass with characterCounter", function(assert) { q.maxLength = 100; assert.equal(q.getControlClass(), inputClasses + " " + constrolWithCharacterCounter + " " + characterCounterBig, "#3"); - StylesManager.applyTheme("default"); }); QUnit.test("Set empty text", function(assert) { diff --git a/packages/survey-core/tests/surveyElementTests.ts b/packages/survey-core/tests/surveyElementTests.ts index 1bd2eb3a58..e42c70c86e 100644 --- a/packages/survey-core/tests/surveyElementTests.ts +++ b/packages/survey-core/tests/surveyElementTests.ts @@ -5,9 +5,8 @@ import { CustomWidgetCollection } from "../src/questionCustomWidgets"; import { Serializer } from "../src/jsonobject"; import { PanelModel } from "../src/panel"; import { Question } from "../src/question"; -import { StylesManager } from "@legacy/stylesmanager"; import { RenderingCompletedAwaiter } from "../src/survey-element"; - +import { setOldTheme } from "./oldTheme"; export default QUnit.module("SurveyElement"); QUnit.test("panel isExpanded and isCollapsed", function (assert) { @@ -55,7 +54,6 @@ QUnit.test("question isExpanded and isCollapsed", function (assert) { }); QUnit.test("element check that title classes are updated after element state updated", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ questions: [ { @@ -75,6 +73,7 @@ QUnit.test("element check that title classes are updated after element state upd } ] }); + setOldTheme(survey); const panel = survey.getAllPanels()[0]; const question = survey.getQuestionByName("q1"); assert.equal(panel.cssTitle, "sv_p_title"); @@ -129,7 +128,6 @@ QUnit.test("creator v1: https://github.com/surveyjs/survey-creator/issues/1744", }); QUnit.test("Check errors location", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [{ type: "text", @@ -149,6 +147,7 @@ QUnit.test("Check errors location", function (assert) { } ] }); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); const questionInMatrix = survey.getAllQuestions()[1].renderedTable.rows[0].cells[0].question; assert.notOk(q1.showErrorsAboveQuestion); @@ -177,7 +176,6 @@ QUnit.test("Check errors location", function (assert) { assert.ok(questionInMatrix.showErrorsAboveQuestion); }); QUnit.test("Check error location for questions in panel", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [ { @@ -192,6 +190,7 @@ QUnit.test("Check error location for questions in panel", function (assert) { } ] }); + setOldTheme(survey); const q1 = survey.getQuestionByName("q1"); assert.notOk(q1.showErrorOnBottom); assert.notOk(q1.showErrorsBelowQuestion); @@ -218,7 +217,6 @@ QUnit.test("Check error location for questions in panel", function (assert) { assert.ok(q1.showErrorsBelowQuestion); }); QUnit.test("allowRootStyle", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [{ type: "text", @@ -239,7 +237,6 @@ QUnit.test("allowRootStyle", function (assert) { assert.deepEqual(q1.rootStyle, {}); }); QUnit.test("rootStyle on mobile", function (assert) { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [{ type: "text", diff --git a/packages/survey-core/tests/surveyShowPreviewTests.ts b/packages/survey-core/tests/surveyShowPreviewTests.ts index 37749e5916..4dbdc566ff 100644 --- a/packages/survey-core/tests/surveyShowPreviewTests.ts +++ b/packages/survey-core/tests/surveyShowPreviewTests.ts @@ -1,8 +1,8 @@ import { SurveyModel } from "../src/survey"; import { surveyLocalization } from "../src/surveyStrings"; import { PanelModel } from "../src/panel"; -import { StylesManager } from "@legacy/stylesmanager"; import { settings } from "../src/settings"; +import { setOldTheme } from "./oldTheme"; export default QUnit.module("SurveyShowPreviewTests"); @@ -303,7 +303,6 @@ QUnit.test("showPreviewBeforeComplete = 'showAnsweredQuestions' set property", f QUnit.test( "showPreviewBeforeComplete = 'showAllQuestions', edit page, #2", function(assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel({ pages: [ { elements: [{ type: "text", name: "q1" }] }, @@ -319,6 +318,7 @@ QUnit.test( { elements: [{ type: "text", name: "q3" }] }, ], }); + setOldTheme(survey); survey.showPreviewBeforeComplete = "showAllQuestions"; survey.currentPageNo = 2; assert.equal(survey.getAllPanels().length, 1, "There is one panel"); @@ -365,7 +365,6 @@ QUnit.test( QUnit.test( "showPreviewBeforeComplete = 'showAllQuestions', edit page", function (assert) { - StylesManager.applyTheme("default"); var survey = new SurveyModel({ "pages": [ { diff --git a/packages/survey-core/tests/surveyTOCTests.ts b/packages/survey-core/tests/surveyTOCTests.ts index 15134ad14a..5dfb6ea62e 100644 --- a/packages/survey-core/tests/surveyTOCTests.ts +++ b/packages/survey-core/tests/surveyTOCTests.ts @@ -640,4 +640,64 @@ QUnit.test("survey.tryNavigateToPage respects validationAllowSwitchPages and val assert.equal(survey.currentPageNo, 0, "currentPageNo #1"); assert.equal(survey.tryNavigateToPage(survey.pages[1]), true, "navigate #9"); assert.equal(survey.currentPageNo, 1, "currentPageNo #2"); -}); \ No newline at end of file +}); +QUnit.test("survey.tryNavigateToPage & survey.onValidatedErrorsOnCurrentPage, Bug#9241", function (assert) { + let json: any = { + "pages": [ + { + "name": "page1", + "elements": [ + { + "type": "text", + "name": "question1", + "isRequired": true + } + ] + }, + { + "name": "page2", + "elements": [ + { + "type": "text", + "name": "question2", + "isRequired": true + } + ] + }, + { + "name": "page3", + "elements": [ + { + "type": "text", + "name": "question3", + "isRequired": true + } + ] + } + ] + }; + const survey = new SurveyModel(json); + const logs = new Array(); + survey.onValidatedErrorsOnCurrentPage.add((sender, options) => { + logs.push(options.page.name); + }); + assert.equal(survey.tryNavigateToPage(survey.pages[1]), false, "try #1"); + assert.deepEqual(logs, ["page1"], "logs #1"); + survey.setValue("question1", "val1"); + assert.equal(survey.tryNavigateToPage(survey.pages[1]), true, "try #2"); + assert.deepEqual(logs, ["page1", "page1"], "logs #2"); + assert.equal(survey.tryNavigateToPage(survey.pages[0]), true, "try #3"); + assert.deepEqual(logs, ["page1", "page1"], "logs #3"); + assert.equal(survey.tryNavigateToPage(survey.pages[2]), false, "try #4"); + assert.equal(survey.currentPageNo, 1, "currentPageNo #4"); + assert.deepEqual(logs, ["page1", "page1", "page1"], "logs #4"); + assert.equal(survey.tryNavigateToPage(survey.pages[1]), false, "try #5"); + assert.deepEqual(logs, ["page1", "page1", "page1"], "logs #5"); + assert.equal(survey.tryNavigateToPage(survey.pages[2]), false, "try #6"); + assert.deepEqual(logs, ["page1", "page1", "page1", "page2"], "logs #6"); + survey.setValue("question2", "val2"); + assert.equal(survey.tryNavigateToPage(survey.pages[2]), true, "try #7"); + assert.deepEqual(logs, ["page1", "page1", "page1", "page2", "page2"], "logs #7"); + assert.equal(survey.tryNavigateToPage(survey.pages[0]), true, "try #8"); + assert.deepEqual(logs, ["page1", "page1", "page1", "page2", "page2"], "logs #8"); +}); diff --git a/packages/survey-core/tests/surveyquestiontests.ts b/packages/survey-core/tests/surveyquestiontests.ts index 72d4d79c30..a28e74f086 100644 --- a/packages/survey-core/tests/surveyquestiontests.ts +++ b/packages/survey-core/tests/surveyquestiontests.ts @@ -37,12 +37,10 @@ import { PanelModel } from "../src/panel"; import { Helpers } from "../src/helpers"; import { CustomWidgetCollection } from "../src/questionCustomWidgets"; import { ConsoleWarnings } from "../src/console-warnings"; -import { StylesManager } from "@legacy/stylesmanager"; import { surveyTimerFunctions } from "../src/surveytimer"; -import { defaultStandardCss } from "@legacy/defaultCss/cssstandard"; import { QuestionPanelDynamicModel } from "../src/question_paneldynamic"; import { QuestionMatrixDynamicModel } from "../src/question_matrixdynamic"; - +import { setOldTheme } from "./oldTheme"; export default QUnit.module("Survey_Questions"); settings.autoAdvanceDelay = 0; @@ -3303,13 +3301,11 @@ QUnit.test("question.paddingLeft and question.paddingRight", function (assert) { assert.deepEqual(question.getRootStyle(), { }); }); QUnit.test("question.paddingLeft from json and defaultV2", function (assert) { - StylesManager.applyTheme("defaultV2"); const survey = new SurveyModel({ questions: [{ type: "text", name: "q1", indent: 1 }], }); const question = survey.getQuestionByName("q1"); assert.equal(question.paddingLeft, "20px"); - StylesManager.applyTheme("default"); }); QUnit.test( @@ -4554,7 +4550,7 @@ QUnit.test("Checkbox question getItemClass() + survey.onUpdateChoiceItemCss", fu }, ], }); - survey.css = defaultStandardCss; + setOldTheme(survey); var q1 = survey.getQuestionByName("q1"); q1.value = [1]; const checkCss = (actual: string, expected: string, message: string): void => { @@ -5437,7 +5433,7 @@ QUnit.test("text question inputSize and inputWidth", function (assert) { assert.equal(q2.inputStyle.width, "", "q2 inputStyle width is undefined"); assert.equal(q3.inputStyle.width, "", "q3 inputStyle width is undefined"); }); -QUnit.test("Multiple Text Question: itemSize", function (assert) { +QUnit.test("Multiple Text Question: inputSize", function (assert) { var mText = new QuestionMultipleTextModel("mText"); mText.items.push(new MultipleTextItemModel("q1")); mText.items.push(new MultipleTextItemModel("q2")); @@ -7760,7 +7756,6 @@ QUnit.test("defaultValueExpression copy the array/object, Bug#8799", function (a }); }); QUnit.test("TextAreaOptions", function (assert) { - StylesManager.applyTheme("defaultV2"); Question["questionCounter"] = 101; const survey = new SurveyModel({ @@ -7824,8 +7819,6 @@ QUnit.test("TextAreaOptions", function (assert) { assert.equal(textAreaOptions.maxLength, undefined, "textAreaOptions maxLength"); assert.equal(textAreaOptions.cols, 50, "textAreaOptions cols"); assert.equal(textAreaOptions.rows, 4, "textAreaOptions rows"); - - StylesManager.applyTheme("default"); }); QUnit.test("survey.validateVisitedEmptyFields #8640", function (assert) { const survey = new SurveyModel({ diff --git a/packages/survey-core/tests/surveytests.ts b/packages/survey-core/tests/surveytests.ts index 8dcff57b2b..1908ecbf41 100644 --- a/packages/survey-core/tests/surveytests.ts +++ b/packages/survey-core/tests/surveytests.ts @@ -62,13 +62,12 @@ import { LocalizableString } from "../src/localizablestring"; import { getRenderedSize, getRenderedStyleSize, increaseHeightByContent, wrapUrlForBackgroundImage } from "../src/utils/utils"; import { Helpers } from "../src/helpers"; import { defaultV2Css } from "../src/defaultCss/defaultV2Css"; -import { StylesManager } from "@legacy/stylesmanager"; import { ITheme } from "../src/themes"; import { Cover } from "../src/header"; import { DomWindowHelper } from "../src/global_variables_utils"; import { ListModel } from "../src/list"; import { _setIsTouch } from "../src/utils/devices"; - +import { oldDefaultTheme, setOldTheme } from "./oldTheme"; export default QUnit.module("Survey"); settings.autoAdvanceDelay = 0; @@ -3828,7 +3827,6 @@ QUnit.test("Several questions in one row - defaultV2", function (assert) { }); QUnit.test("Several questions in complex questions row - defaultV2", function (assert) { - StylesManager.applyTheme("defaultV2"); let survey = new SurveyModel({}); survey.fromJSON({ "pages": [ @@ -3856,7 +3854,7 @@ QUnit.test("Several questions in complex questions row - defaultV2", function (a ] }); assert.equal(survey.getAllQuestions()[0].templateElements[0].rightIndent, 0, "the first indent is 0"); - StylesManager.applyTheme("default"); + }); QUnit.test( @@ -6301,9 +6299,10 @@ QUnit.test("onMatrixRowRemoved. Added a case for Bug#2557", function (assert) { QUnit.test( "onUpdatePanelCssClasses keeps original css - https://github.com/surveyjs/surveyjs/issues/1333", function (assert) { - StylesManager.applyTheme("default"); - var css = surveyCss.getCss(); + + var css = oldDefaultTheme; var survey = new SurveyModel(); + survey.setCss(css, false); survey.onUpdatePanelCssClasses.add(function (survey, options) { if (options.panel.name == "panel1") options.cssClasses.panel["container"] = "hereIam"; @@ -6354,6 +6353,7 @@ QUnit.test("Apply css for questions on start page", function (assert) { { elements: [{ type: "text", name: "q2" }] } ] }); + setOldTheme(survey); survey.css = { text: { mainRoot: "custom_class" } }; const q1 = survey.getQuestionByName("q1"); const q2 = survey.getQuestionByName("q2"); @@ -6374,9 +6374,10 @@ QUnit.test("onUpdatePageCssClasses is raised", function (assert) { }); QUnit.test("Survey Elements css", function (assert) { - const css = surveyCss.getCss(); + const css = oldDefaultTheme; css.question.titleRequired = "required"; const survey = new SurveyModel(); + setOldTheme(survey); survey.onUpdateQuestionCssClasses.add(function (survey, options) { if (options.question.name === "q2") options.cssClasses["newItem"] = "hereIam"; @@ -6419,6 +6420,7 @@ QUnit.test("Question cssRoot", function (assert) { ], }; var survey = new SurveyModel(json); + setOldTheme(survey); assert.equal( survey.getQuestionByName("q1").cssRoot, "sv_q sv_qstn", @@ -6431,6 +6433,7 @@ QUnit.test("Question cssRoot", function (assert) { ); survey = new SurveyModel(json); + setOldTheme(survey); survey.onUpdateQuestionCssClasses.add(function (survey, options) { if (options.question.getType() == "checkbox") { options.cssClasses.mainRoot = "testMainRoot"; @@ -12649,7 +12652,9 @@ QUnit.test( QUnit.test("Different css for different surveys", function (assert) { var json = { questions: [{ type: "text", name: "q" }] }; var survey1 = new SurveyModel(); + setOldTheme(survey1); var survey2 = new SurveyModel(); + setOldTheme(survey2); var defaultQuestionRoot = survey1.css.question.mainRoot; survey1.css.question.mainRoot += " class1"; survey2.css.question.mainRoot += " class2"; @@ -12681,6 +12686,7 @@ QUnit.test("Different css for different surveys", function (assert) { QUnit.test("Question css classes", function (assert) { var survey = new SurveyModel(); + setOldTheme(survey); survey.css.question.hasError = "error"; survey.css.question.small = "small"; survey.css.question.title = "title"; @@ -12940,8 +12946,9 @@ QUnit.test("Survey isLogoBefore/isLogoAfter", function (assert) { }); QUnit.test("Survey logoClassNames", function (assert) { - StylesManager.applyTheme("default"); + var survey = new SurveyModel({}); + setOldTheme(survey); assert.equal(survey.logoPosition, "left"); assert.equal(survey.logoClassNames, "sv_logo sv-logo--left"); @@ -13458,6 +13465,7 @@ QUnit.test( }, ], }); + setOldTheme(survey); var q1 = survey.getQuestionByName("q1"); survey.pages[0].questionTitleLocation = "left"; assert.equal(q1.getPropertyValue("cssHeader", "").trim(), "title-left"); @@ -14933,7 +14941,7 @@ QUnit.test("survey.isLazyRendering", function (assert) { assert.equal(survey.isLazyRendering, true, "set in settings"); settings.lazyRowsRendering = false; assert.equal(survey.isLazyRendering, false, "Not set 2"); - survey.lazyRendering = true; + survey.lazyRenderingEnabled = true; assert.equal(survey.isLazyRendering, true, "set in survey"); }); QUnit.test("getSize", function (assert) { @@ -15767,7 +15775,6 @@ QUnit.test("utils.increaseHeightByContent", assert => { assert.equal(element.style.height, "95px"); }); QUnit.test("test titleTagName, survey.cssTitle properties and getTitleOwner", assert => { - StylesManager.applyTheme("default"); const survey = new SurveyModel({ elements: [ { @@ -15776,6 +15783,7 @@ QUnit.test("test titleTagName, survey.cssTitle properties and getTitleOwner", as } ] }); + setOldTheme(survey); assert.equal(survey.getQuestionByName("q1").titleTagName, "h5"); assert.equal((survey.getPanelByName("p1")).titleTagName, "h4"); assert.equal(survey.pages[0].titleTagName, "h4"); @@ -16473,7 +16481,7 @@ QUnit.test("Check isMobile set via processResponsiveness method", function (asse assert.notOk(isProcessed); }); QUnit.test("Check addNavigationItem", function (assert) { - StylesManager.applyTheme("default"); + const survey = new SurveyModel({ "elements": [ { @@ -16482,6 +16490,7 @@ QUnit.test("Check addNavigationItem", function (assert) { } ] }); + setOldTheme(survey); const action1 = survey.addNavigationItem({ id: "custom-btn", visibleIndex: 3 }); assert.ok(action1 === survey.navigationBar.actions[0]); assert.equal(action1.id, "custom-btn"); @@ -16509,6 +16518,7 @@ QUnit.test("Check default navigation items relevance", function (assert) { } ] }); + setOldTheme(survey); survey.css = { actionBar: { item: "custom-action" }, navigationButton: "custom-css", navigation: { start: "custom-start" } }; const action = survey.navigationBar.actions[0]; assert.equal(action.getActionBarItemCss(), "custom-action custom-css custom-start"); @@ -16528,6 +16538,7 @@ QUnit.test("Check rootCss property", function (assert) { } ] }); + setOldTheme(survey); survey.css = { root: "test-root-class" }; assert.equal(survey.rootCss, "test-root-class sv_progress--pages"); }); @@ -18594,6 +18605,29 @@ QUnit.test("getContainerContent - navigation with page.navigationButtonsVisibili assert.deepEqual(getContainerContent("left"), [], "default left"); assert.deepEqual(getContainerContent("right"), [], "default right"); }); +QUnit.test("survey.showNavigationButtons = 'none', page.navigationButtonsVisibility = 'show' & firstPageIsStarted is true, Bug#9248", function (assert) { + const survey = new SurveyModel({ + showNavigationButtons: "none", + firstPageIsStarted: true, + pages: [ + { + "navigationButtonsVisibility": "show", + "elements": [{ type: "text", name: "q1" }] + }, + { + "elements": [{ type: "text", name: "q2" }] + }, + { + "elements": [{ type: "text", name: "q2" }] + } + ] + }); + assert.equal(survey.state, "starting", "The first page is started"); + assert.equal(survey.isNavigationButtonsShowing, "bottom", "The first page is started"); + survey.start(); + assert.equal(survey.state, "running", "The start button is cliced"); + assert.equal(survey.isNavigationButtonsShowing, "none", "Hide navigation buttons"); +}); QUnit.test("getContainerContent - header elements order", function (assert) { function getContainerContent(container: LayoutElementContainer) { @@ -21111,4 +21145,4 @@ QUnit.test("#9110 check focus question inside paneldynamic works correctly", fun assert.equal(log, "->text_question_id->focused text question"); SurveyElement.ScrollElementToViewCore = oldScrollElementToViewCore; SurveyElement.ScrollElementToTop = oldScrollElementToTop; -}); \ No newline at end of file +}); diff --git a/packages/survey-core/tests/surveytimertests.ts b/packages/survey-core/tests/surveytimertests.ts index 1f6c5b5cc8..46df131df1 100644 --- a/packages/survey-core/tests/surveytimertests.ts +++ b/packages/survey-core/tests/surveytimertests.ts @@ -1,6 +1,7 @@ import { SurveyModel } from "../src/survey"; import { SurveyTimer, surveyTimerFunctions, SurveyTimerEvent } from "../src/surveytimer"; import { defaultV2Css } from "../src/defaultCss/defaultV2Css"; +import { setOldTheme } from "./oldTheme"; export default QUnit.module("SurveyTimer"); @@ -486,6 +487,7 @@ QUnit.test("Test SurveyTimerModel with clock", function(assert) { QUnit.test("Test showTimerAsClock flag", function(assert) { const createSurvey = (timeLimit: number, timeLimitPerPage: number): SurveyModel => { var survey = new SurveyModel(); + setOldTheme(survey); survey.timeLimit = timeLimit; survey.timeLimitPerPage = timeLimitPerPage; survey.addNewPage("p1"); diff --git a/themes-import.js b/packages/survey-core/themes-import.js similarity index 100% rename from themes-import.js rename to packages/survey-core/themes-import.js diff --git a/themes.json b/packages/survey-core/themes.json similarity index 100% rename from themes.json rename to packages/survey-core/themes.json diff --git a/packages/survey-core/tsconfig.icons.json b/packages/survey-core/tsconfig.icons.json new file mode 100644 index 0000000000..c74d35a8c1 --- /dev/null +++ b/packages/survey-core/tsconfig.icons.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "declarationDir": "./build/icons" + }, + "include": [ + "./src/iconsV1.ts", + "./src/iconsV2.ts", + ], + "exclude": [], +} \ No newline at end of file diff --git a/build-scripts/webpack-remove-core-from-name.js b/packages/survey-core/webpack-remove-core-from-name.js similarity index 100% rename from build-scripts/webpack-remove-core-from-name.js rename to packages/survey-core/webpack-remove-core-from-name.js diff --git a/packages/survey-core/webpack.config.js b/packages/survey-core/webpack.config.js index 0a147c8156..84675064b7 100644 --- a/packages/survey-core/webpack.config.js +++ b/packages/survey-core/webpack.config.js @@ -6,7 +6,7 @@ const path = require("path"); const RemoveEmptyScriptsPlugin = require("webpack-remove-empty-scripts"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); var DashedNamePlugin = require("../../build-scripts/webpack-dashed-name"); -var RemoveCoreFromName = require("../../build-scripts/webpack-remove-core-from-name"); +var RemoveCoreFromName = require("./webpack-remove-core-from-name"); const mergeFiles = require("merge-files"); const packageJson = require("./package.json"); @@ -36,7 +36,7 @@ var buildPlatformJson = { files: [ "**/*" ], - "main": "survey-core.js", + "main": "survey.core.js", "repository": { "type": "git", "url": "https://github.com/surveyjs/surveyjs.git" @@ -103,7 +103,7 @@ module.exports = function (options) { var config = { mode: isProductionBuild ? "production" : "development", entry: { - [packageJson.name]: path.resolve(__dirname, "./entries/index.ts"), + "survey.core": path.resolve(__dirname, "./entries/index.ts"), defaultV2: path.resolve(__dirname, "./src/defaultV2-theme/defaultV2.scss"), "defaultV2.fontless": path.resolve(__dirname, "./src/defaultV2-theme/defaultV2.fontless.scss") }, @@ -172,7 +172,7 @@ module.exports = function (options) { new webpack.ProgressPlugin(percentage_handler), new DashedNamePlugin(), new webpack.DefinePlugin({ - "process.env.ENVIRONMENT": JSON.stringify(options.buildType), + "process.env.RELEASE_DATE": JSON.stringify(new Date().toISOString().slice(0, 10)), "process.env.VERSION": JSON.stringify(packageJson.version), }), new RemoveCoreFromName(), diff --git a/packages/survey-core/webpack.i18n.config.js b/packages/survey-core/webpack.i18n.config.js index ba0f4c088b..862ac5e686 100644 --- a/packages/survey-core/webpack.i18n.config.js +++ b/packages/survey-core/webpack.i18n.config.js @@ -8,7 +8,7 @@ var packageJson = require("./package.json"); const config = { entry: { - "survey-core.i18n": path.resolve(__dirname, "./entries/i18n.ts"), + "survey.i18n": path.resolve(__dirname, "./entries/i18n.ts"), }, externals: { "survey-core": { @@ -34,7 +34,7 @@ function patchFilename(options) { config.output = {}; const isProductionBuild = options.buildType === "prod"; config.output.filename = (pathData) => { - return (pathData.chunk.name == "survey-core.i18n" ? "[name]" : "i18n/[name]") + (isProductionBuild ? ".min" : "") + ".js"; + return (pathData.chunk.name == "survey.i18n" ? "[name]" : "i18n/[name]") + (isProductionBuild ? ".min" : "") + ".js"; }; } @@ -45,7 +45,7 @@ module.exports = function (options) { patchEntries(); patchFilename(options); const mainConfig = webpackCommonConfig(options); - delete mainConfig.entry[packageJson.name]; + mainConfig.entry = {}; mainConfig.plugins.shift(); return merge(mainConfig, config); }; \ No newline at end of file diff --git a/packages/survey-core/webpack.icons.config.js b/packages/survey-core/webpack.icons.config.js new file mode 100644 index 0000000000..38fb86f23e --- /dev/null +++ b/packages/survey-core/webpack.icons.config.js @@ -0,0 +1,24 @@ +"use strict"; +const webpackCommonConfig = require("./webpack.config"); +const { merge } = require("webpack-merge"); +var FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries"); +var path = require("path"); + +const config = { + output: { + path: __dirname + "/build/icons" + }, + entry: { + "iconsV1": path.resolve(__dirname, "./src/iconsV1.ts"), + "iconsV2": path.resolve(__dirname, "./src/iconsV2.ts"), + }, + plugins: [new FixStyleOnlyEntriesPlugin()], +}; + +module.exports = function (options) { + options.platform = ""; + options.tsConfigFile = path.resolve(__dirname, "./tsconfig.icons.json"); + const mainConfig = webpackCommonConfig(options); + mainConfig.entry = {}; + return merge(mainConfig, config); +}; diff --git a/build-scripts/survey-js-ui/README.md b/packages/survey-js-ui/README.md similarity index 96% rename from build-scripts/survey-js-ui/README.md rename to packages/survey-js-ui/README.md index 417ee90800..ac3a5fb8be 100644 --- a/build-scripts/survey-js-ui/README.md +++ b/packages/survey-js-ui/README.md @@ -1,51 +1,51 @@ -# SurveyJS Form Library UI for HTML/CSS/JavaScript Applications - - - -[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) - -Tested with TestCafe - - -Issues - - -Closed issues - - -A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your vanilla JS applications or integrate them with any frontend framework. - -## Features - -- Dynamic forms, surveys, polls, and quizzes for your JavaScript application -- Integration with [React](https://www.npmjs.com/package/survey-react-ui), [Angular](https://www.npmjs.com/package/survey-angular-ui), and [Vue](https://www.npmjs.com/package/survey-vue3-ui) -- Possibility of integration with any other frontend framework -- Tiny and fast [Preact](https://preactjs.com/) library at the core -- 20+ built-in question types and support for custom question types -- Built-in themes and CSS customization -- Answer validation -- TypeScript support -- Community-supported UI localization to 50+ languages -- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) -- Compatibility with any server + database combination -- Third-party component integration - -## Get Started - -To get started with SurveyJS Form Library UI for HTML/CSS/JavaScript applications, refer to the following tutorial: [Add a Survey to a JavaScript Application](https://surveyjs.io/form-library/documentation/get-started-html-css-javascript). - -## Resources - -- [Website](https://surveyjs.io/) -- [Documentation](https://surveyjs.io/form-library/documentation/overview) -- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/) -- [What's New](https://surveyjs.io/WhatsNew) - -## Build SurveyJS Form Library UI from Sources - -Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). - -## Licensing - -SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). +# SurveyJS Form Library UI for HTML/CSS/JavaScript Applications + + + +[![Build Status](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_apis/build/status/SurveyJS%20Library?branchName=master)](https://dev.azure.com/SurveyJS/SurveyJS%20Integration%20Tests/_build/latest?definitionId=7&branchName=master) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) + +Tested with TestCafe + + +Issues + + +Closed issues + + +A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your vanilla JS applications or integrate them with any frontend framework. + +## Features + +- Dynamic forms, surveys, polls, and quizzes for your JavaScript application +- Integration with [React](https://www.npmjs.com/package/survey-react-ui), [Angular](https://www.npmjs.com/package/survey-angular-ui), and [Vue](https://www.npmjs.com/package/survey-vue3-ui) +- Possibility of integration with any other frontend framework +- Tiny and fast [Preact](https://preactjs.com/) library at the core +- 20+ built-in question types and support for custom question types +- Built-in themes and CSS customization +- Answer validation +- TypeScript support +- Community-supported UI localization to 50+ languages +- Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included) +- Compatibility with any server + database combination +- Third-party component integration + +## Get Started + +To get started with SurveyJS Form Library UI for HTML/CSS/JavaScript applications, refer to the following tutorial: [Add a Survey to a JavaScript Application](https://surveyjs.io/form-library/documentation/get-started-html-css-javascript). + +## Resources + +- [Website](https://surveyjs.io/) +- [Documentation](https://surveyjs.io/form-library/documentation/overview) +- [Live Examples](https://surveyjs.io/form-library/examples/nps-question/) +- [What's New](https://surveyjs.io/WhatsNew) + +## Build SurveyJS Form Library UI from Sources + +Refer to instructions in the root README file: [Build the SurveyJS Form Library from Sources](https://github.com/surveyjs/survey-library#build-the-surveyjs-form-library-from-sources). + +## Licensing + +SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE). \ No newline at end of file diff --git a/src/entries/js-ui.ts b/packages/survey-js-ui/entries/index.ts similarity index 82% rename from src/entries/js-ui.ts rename to packages/survey-js-ui/entries/index.ts index 4a0e910581..3268e43ece 100644 --- a/src/entries/js-ui.ts +++ b/packages/survey-js-ui/entries/index.ts @@ -1,112 +1,110 @@ -import * as React from "react"; -import * as ReactDOM from "react-dom"; - -export { useState, - useId, - useReducer, - useEffect, - useLayoutEffect, - useInsertionEffect, - useTransition, - useDeferredValue, - useSyncExternalStore, - startTransition, - useRef, - useImperativeHandle, - useMemo, - useCallback, - useContext, - useDebugValue, - version, - Children, - render, - hydrate, - unmountComponentAtNode, - createPortal, - createElement, - createContext, - createFactory, - cloneElement, - createRef, - Fragment, - isValidElement, - isFragment, - isMemo, - findDOMNode, - Component, - PureComponent, - memo, - forwardRef, - flushSync, - unstable_batchedUpdates, - StrictMode, - Suspense, - SuspenseList, - lazy, } from "preact/compat"; - -// eslint-disable-next-line surveyjs/no-imports-from-entries -import { Survey, PopupSurvey } from "../../packages/survey-react-ui/entries/react-ui-model"; - -import { SurveyModel } from "survey-core"; - -export function renderSurvey(model: SurveyModel, element: HTMLElement, props: any = {}) { - const survey = React.createElement(Survey, { model, ...props }); - ReactDOM.render(survey, element); -} - -export function renderPopupSurvey(model: SurveyModel, element: HTMLElement, props: any = {}) { - const survey = React.createElement(PopupSurvey, { model, ...props }); - ReactDOM.render(survey, element); -} - -function doPopupSurvey(props: any): void { - return this.each(function () { - renderPopupSurvey(props.model, this, props); - }); -} - -let gcontext = globalThis; -if (typeof globalThis === "undefined") gcontext = window; -let jQueryInst = gcontext["jQuery"] || gcontext["$"]; - -if (typeof jQueryInst !== "undefined") { - initJquery(jQueryInst); -} else { - try { - jQueryInst = require("jquery"); - initJquery(jQueryInst); - } catch (ex) { - } -} - -function initJquery(instance: any) { - instance["fn"].extend({ - Survey: function (props: any) { - return this.each(function () { - renderSurvey(props.model, this, props); - } as any); - }, - PopupSurvey: doPopupSurvey, - SurveyWindow: doPopupSurvey - }); -} - -SurveyModel.platform = "js-ui"; -SurveyModel.prototype["render"] = function (element: any = null) { - if (this.renderCallback) { - this.renderCallback(); - } else { - renderSurvey(this, element); - } -}; - -export const preact: any = React; - -export * from "../../packages/survey-react-ui/entries/react-ui-model"; -export * from "./core-export"; - -export { SurveyModel as Model } from "survey-core"; - -import { checkLibraryVersion } from "survey-core"; - -checkLibraryVersion(`${process.env.VERSION}`, "survey-js-ui"); +import * as React from "react"; +import * as ReactDOM from "react-dom"; + +export { useState, + useId, + useReducer, + useEffect, + useLayoutEffect, + useInsertionEffect, + useTransition, + useDeferredValue, + useSyncExternalStore, + startTransition, + useRef, + useImperativeHandle, + useMemo, + useCallback, + useContext, + useDebugValue, + version, + Children, + render, + hydrate, + unmountComponentAtNode, + createPortal, + createElement, + createContext, + createFactory, + cloneElement, + createRef, + Fragment, + isValidElement, + isFragment, + isMemo, + findDOMNode, + Component, + PureComponent, + memo, + forwardRef, + flushSync, + unstable_batchedUpdates, + StrictMode, + Suspense, + SuspenseList, + lazy, } from "preact/compat"; + +// eslint-disable-next-line surveyjs/no-imports-from-entries +import { Survey, PopupSurvey } from "../../survey-react-ui/entries/react-ui-model"; + +import { SurveyModel } from "survey-core"; + +export function renderSurvey(model: SurveyModel, element: HTMLElement, props: any = {}) { + const survey = React.createElement(Survey, { model, ...props }); + ReactDOM.render(survey, element); +} + +export function renderPopupSurvey(model: SurveyModel, element: HTMLElement, props: any = {}) { + const survey = React.createElement(PopupSurvey, { model, ...props }); + ReactDOM.render(survey, element); +} + +function doPopupSurvey(props: any): void { + return this.each(function () { + renderPopupSurvey(props.model, this, props); + }); +} + +let gcontext = globalThis; +if (typeof globalThis === "undefined") gcontext = window; +let jQueryInst = (gcontext as any)["jQuery"] || (gcontext as any)["$"]; + +if (typeof jQueryInst !== "undefined") { + initJquery(jQueryInst); +} else { + try { + jQueryInst = require("jquery"); + initJquery(jQueryInst); + } catch (ex) { + } +} + +function initJquery(instance: any) { + instance["fn"].extend({ + Survey: function (props: any) { + return this.each(function () { + renderSurvey(props.model, this, props); + } as any); + }, + PopupSurvey: doPopupSurvey, + SurveyWindow: doPopupSurvey + }); +} + +SurveyModel.platform = "js-ui"; +SurveyModel.prototype["render"] = function (element: any = null) { + if (this.renderCallback) { + this.renderCallback(); + } else { + renderSurvey(this, element); + } +}; + +export const preact: any = React; + +export * from "../../survey-react-ui/entries/react-ui-model"; +export { SurveyModel, SurveyWindowModel, SurveyModel as Model, settings, ISurveyEnvironment, surveyLocalization, surveyStrings } from "survey-core"; + +import { checkLibraryVersion } from "survey-core"; + +checkLibraryVersion(`${process.env.VERSION}`, "survey-js-ui"); diff --git a/packages/survey-js-ui/examples_test/customWidget/survey-js-ui.html b/packages/survey-js-ui/examples_test/customWidget/survey-js-ui.html new file mode 100644 index 0000000000..87d0c1c190 --- /dev/null +++ b/packages/survey-js-ui/examples_test/customWidget/survey-js-ui.html @@ -0,0 +1,60 @@ + + + + + Welcome to Jquery UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/packages/survey-js-ui/examples_test/defaultV2/survey-js-ui.html b/packages/survey-js-ui/examples_test/defaultV2/survey-js-ui.html new file mode 100644 index 0000000000..aecf3607ce --- /dev/null +++ b/packages/survey-js-ui/examples_test/defaultV2/survey-js-ui.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + +
+
+ \ No newline at end of file diff --git a/packages/survey-js-ui/index.html b/packages/survey-js-ui/index.html new file mode 100644 index 0000000000..7ba8f48e91 --- /dev/null +++ b/packages/survey-js-ui/index.html @@ -0,0 +1,18 @@ + + + + + Welcome to UI + + + + + + + +
+
+ + + + \ No newline at end of file diff --git a/packages/survey-js-ui/index.js b/packages/survey-js-ui/index.js new file mode 100644 index 0000000000..a1874f7446 --- /dev/null +++ b/packages/survey-js-ui/index.js @@ -0,0 +1,977 @@ +//Add the price property into choices +Survey.Serializer.addProperty("itemvalue", "price:number"); + +var getItemPrice = function (params) { + //this.row property available in cells of dropdown and dynamic matrices questions + var question = !!this.row + ? this.row.getQuestionByColumnName(params[0]) + : null; + //if we can't find a question inside the cell (by row and column name) then return + if (!question) return 0; + + //get the selected item/choice + var selItem = question.selectedItem; + //return 0 if a user did not select the item yet. + return !!selItem ? selItem.price : 0; +}; +//Register the custom function +Survey.FunctionFactory.Instance.register("getItemPrice", getItemPrice); + +var json = { + showProgressBar: "both", + title: "Survey New Design Test", + logo: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg", + logoPosition: "left", + questions: [ + { + name: "signature", + type: "signaturepad", + title: "Sign here", + isRequired: true + }, + { + name: "name", + type: "text", + title: "Text", + placeHolder: "Jon Snow", + isRequired: true + }, + { + name: "birthdate", + type: "text", + inputType: "date", + title: "Text Date", + isRequired: true + }, + { + name: "color", + type: "text", + inputType: "color", + title: "Text Color" + }, + { + name: "email", + type: "text", + inputType: "email", + title: "Text Email", + placeHolder: "jon.snow@nightwatch.org", + isRequired: true, + validators: [ + { + type: "email" + } + ] + }, + { + type: "dropdown", + name: "cars", + title: "Dropdown", + isRequired: true, + showNoneItem: true, + colCount: 4, + choices: [ + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "checkbox", + name: "car", + title: "Checkbox", + isRequired: true, + showSelectAllItem: true, + showNoneItem: true, + colCount: 4, + choices: [ + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "radiogroup", + name: "carss", + title: "Radiogroup", + isRequired: true, + colCount: 4, + choices: [ + "None", + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "image", + name: "banner", + imageHeight: "300px", + imageWidth: "450px", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg" + }, + { + type: "imagepicker", + name: "choosepicture", + title: "Imagepicker", + imageHeight: "150px", + imageWidth: "225px", + choices: [ + { + value: "lion", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg" + }, + { + value: "giraffe", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg" + }, + { + value: "panda", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg" + }, + { + value: "camel", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg" + } + ] + }, + { + type: "boolean", + name: "bool", + title: "Boolean", + label: "Are you 21 or older?", + isRequired: true + }, + { + type: "matrix", + name: "Quality", + title: "Matrix", + columns: [ + { + value: 1, + text: "Strongly Disagree" + }, + { + value: 2, + text: "Disagree" + }, + { + value: 3, + text: "Neutral" + }, + { + value: 4, + text: "Agree" + }, + { + value: 5, + text: "Strongly Agree" + } + ], + rows: [ + { + value: "affordable", + text: "Product is affordable" + }, + { + value: "does what it claims", + text: "Product does what it claims" + }, + { + value: "better than others", + text: "Product is better than other products on the market" + }, + { + value: "easy to use", + text: "Product is easy to use" + } + ] + }, + { + type: "matrix", + name: "planningPerformance", + title: "Matrix Rubric", + columns: [ + "Ineffective", + "Improvement Necessary", + "Effective", + "Highly Effective" + ], + rows: [ + { + value: "dataToPlan", + text: "Utilizes Assessment Data to Plan" + }, + { + value: "ambitiousGoals", + text: "Ambitious and Measurable Achievement Goal" + }, + { + value: "developsStandards", + text: + "Develops Standards.
Based Unit Plans and Assessments.
Evaluation Values." + }, + { + value: "createsObjective", + text: "Creates Objective - Driven Lesson Plans and Assessments" + } + ], + cells: { + dataToPlan: { + Ineffective: + "Teacher rarely or never uses formal and informal assessment data when planning", + "Improvement Necessary": + "Teacher uses formal and informal assessment data to formulate
- Achievement goals, unit plans, or lesson plans, but not all of these", + Effective: + "Teacher uses formal and informal assessment data to formulate
- Achievement goals, unit plans, and lesson plans", + "Highly Effective": + "Teacher uses formal and informal assessment data to formulate achievement goals, unit plans, and lesson plans
- Incorporates differentiated instructional strategies in planning to reach every student at his/her level of understanding" + }, + ambitiousGoals: { + Ineffective: + "Teacher rarely or never develops achievement goals for the class, or goals are developed but are too general to be helpful for planning purposes", + "Improvement Necessary": + "Teacher develops an annual student achievement goalthat lacks one or more of these traits:
- Measurable
- Aligned to content standards
- Includes benchmarks to help monitor learning and inform interventions throughout the year", + Effective: + "Teacher develops an annual student achievement goal that
- Is measurable
- Is aligned to content standards
- Includes benchmarks to help monitor learning and inform interventions throughout the year", + "Highly Effective": + "Teacher develops an annual student achievement goal that
- Is measurable
- Is aligned to content standards where applicable
- Includes benchmarks to help monitor learning and informinterventions throughout the year" + }, + developsStandards: { + Ineffective: + "Teacher rarely or never plans by identifying content standards that students will master in each unit, or there is little to no evidence that teacher plans units at all", + "Improvement Necessary": + "Based on achievement goals, teacher plans units but omits one or more of these steps:
- Identifying content standards that students will master in each unit
- Creating assessments before planning units
- Allocating an instructionally appropriate amount of time for each unit", + Effective: + "Based on achievement goals, teacher plans units by
- Identifying content standards that students will master in each unit
- Creating assessments before each unit begins for backwards planning
- Allocating an instructionally appropriate amount of time for each unit", + "Highly Effective": + "Based on achievement goals, teacher plans units by
- Identifying content standards that students will master in each unit
- Creating assessments before each unit begins for backwards planning
- Allocating an instructionally appropriate amount of time for each unit" + }, + createsObjective: { + Ineffective: + "Teacher rarely or never uses a system to track student assessment/progress data and/or has an ineffective grading system", + "Improvement Necessary": + "Teacher uses a data tracking system to record student assessment / progress data and maintain a grading system but fails in one or more of the following steps
- Use data to analyze student progress toward mastery or to plan future lessons / units
- Have a grading system that appropriately aligns with student learning goals", + Effective: + "Teacher uses an effective data tracking system for
- Recording student assessment / progress data
- Analyzing student progress towards mastery and planning future lessons/units accordingly
- Maintaining a grading system aligned to student learning goals", + "Highly Effective": + "Teacher uses an effective data tracking system that
- Records student assessment / progress data
- Analyzes student progress toward mastery and plans future lessons/units accordingly
- Maintains a grading system aligned to student learning goals" + } + } + }, + { + type: "matrix Dropdown", + name: "frameworksRate", + title: "Matrixdropdown", + choices: ["Excelent", "Good", "Average", "Fair", "Poor"], + columns: [ + { + name: "using", + title: "Do you use it?", + choices: ["Yes", "No"], + cellType: "radiogroup" + }, + { + name: "experience", + title: "How long do you use it?", + choices: [ + { + value: 5, + text: "3-5 years" + }, + { + value: 2, + text: "1-2 years" + }, + { + value: 1, + text: "less than a year" + } + ] + }, + { + name: "strength", + title: "What is main strength?", + choices: ["Easy", "Compact", "Fast", "Powerfull"], + cellType: "checkbox" + }, + { + name: "knowledge", + title: "Please describe your experience", + cellType: "text" + }, + { + name: "rate", + title: "Please rate the framework itself" + } + ], + rows: [ + { + value: "angularv1", + text: "angularjs v1.x" + }, + { + value: "angularv2", + text: "angularjs v2" + }, + { + value: "knockoutjs" + }, + { + value: "reactjs" + } + ] + }, + { + type: "matrixdynamic", + name: "teachersRate", + title: "Matrix Dynamic", + addRowText: "Add Subject", + horizontalScroll: true, + columnMinWidth: "130px", + columnColCount: 1, + cellType: "radiogroup", + choices: [ + { + value: 1, + text: "Yes" + }, + { + value: 0, + text: "Sometimes" + }, + { + value: -1, + text: "No" + } + ], + columns: [ + { + name: "subject", + cellType: "dropdown", + title: "Select a subject", + isRequired: true, + minWidth: "300px", + choices: [ + "English: American Literature", + "English: British and World Literature", + "Math: Consumer Math", + "Math: Practical Math", + "Math: Developmental Algebra", + "Math: Continuing Algebra", + "Math: Pre-Algebra", + "Math: Algebra", + "Math: Geometry", + "Math: Integrated Mathematics", + "Science: Physical Science", + "Science: Earth Science", + "Science: Biology", + "Science: Chemistry", + "History: World History", + "History: Modern World Studies", + "History: U.S. History", + "History: Modern U.S. History", + "Social Sciences: U.S. Government and Politics", + "Social Sciences: U.S. and Global Economics", + "World Languages: Spanish", + "World Languages: French", + "World Languages: German", + "World Languages: Latin", + "World Languages: Chinese", + "World Languages: Japanese" + ] + }, + { + name: "explains", + title: "Clearly explains the objectives" + }, + { + name: "interesting", + title: "Makes class interesting" + }, + { + name: "effective", + title: "Uses class time effectively" + }, + { + name: "knowledge", + title: "Knows the subject matter" + }, + { + name: "recognition", + title: "Recognizes and acknowledges effort" + }, + { + name: "inform", + title: "Keeps me informed of my progress" + }, + { + name: "opinion", + title: "Encourages and accepts different opinions" + }, + { + name: "respect", + title: "Has the respect of the student" + }, + { + name: "cooperation", + title: "Encourages cooperation and participation" + }, + { + name: "parents", + title: "Communicates with my parents" + }, + { + name: "selfthinking", + title: "Encourages me to think for myself" + }, + { + name: "frusturation", + cellType: "comment", + title: "Is there anything about this class that frustrates you?", + minWidth: "250px" + }, + { + name: "likeTheBest", + cellType: "comment", + title: "What do you like best about this class and/or teacher?", + minWidth: "250px" + }, + { + name: "improvements", + cellType: "comment", + title: + "What do you wish this teacher would do differently that would improve this class?", + minWidth: "250px" + } + ], + rowCount: 2 + }, + { + type: "matrixdynamic", + name: "Current Level of Function", + title: "Matrix Dynamic (vertical columns)", + columnLayout: "vertical", + minRowCount: 1, + maxRowCount: 5, + columns: [ + { + name: "Date", + title: "Date", + cellType: "text", + inputType: "date" + }, + { + name: "AmbDistance", + title: "Amb Distance", + cellType: "text" + }, + { + name: "Amb Assistance", + cellType: "dropdown", + choices: ["D", "MAX", "MOD", "MIN"] + }, + { + name: "Standing Tolerance", + cellType: "text" + }, + { + name: "UE Strength", + cellType: "text" + }, + { + name: "Cognitive Function", + cellType: "comment" + } + ], + choices: [1], + cellType: "comment", + confirmDelete: true, + addRowText: "Add Date +", + removeRowText: "Remove" + }, + { + type: "matrixdynamic", + name: "orderList", + rowCount: 1, + minRowCount: 1, + title: "Matrix Dynamic (totals)", + addRowText: "Add new item", + columns: [ + { + name: "id", + title: "Id", + cellType: "expression", + expression: "{rowIndex}" + }, + { + name: "phone_model", + title: "Phone model", + isRequired: true, + totalType: "count", + totalFormat: "Items count: {0}", + choices: [ + { + value: "iPhone7-32", + text: "iPhone 7, 32GB", + price: 449 + }, + { + value: "iPhone7-128", + text: "iPhone 7, 128GB", + price: 549 + }, + { + value: "iPhone7Plus-32", + text: "iPhone 7 Plus, 32GB", + price: 569 + }, + { + value: "iPhone7Plus-128", + text: "iPhone 7 Plus, 128GB", + price: 669 + }, + { + value: "iPhone8-64", + text: "iPhone 8, 64GB", + price: 599 + }, + { + value: "iPhone8-256", + text: "iPhone 8, 256GB", + price: 749 + }, + { + value: "iPhone8Plus-64", + text: "iPhone 8 Plus, 64GB", + price: 699 + }, + { + value: "iPhone8Plus-256", + text: "iPhone 8 Plus, 256GB", + price: 849 + }, + { + value: "iPhoneXR-64", + text: "iPhone XR, 64GB", + price: 749 + }, + { + value: "iPhoneXR-128", + text: "iPhone XR, 128GB", + price: 799 + }, + { + value: "iPhoneXR-256", + text: "iPhone XR, 256GB", + price: 899 + }, + { + value: "iPhoneXS-64", + text: "iPhone XS, 64GB", + price: 999 + }, + { + value: "iPhoneXS-256", + text: "iPhone XS, 256GB", + price: 1149 + }, + { + value: "iPhoneXS-512", + text: "iPhone XS, 512GB", + price: 1349 + }, + { + value: "iPhoneXSMAX-64", + text: "iPhone XS Max, 64GB", + price: 1099 + }, + { + value: "iPhoneXSMAX-256", + text: "iPhone XS Max, 256GB", + price: 1249 + }, + { + value: "iPhoneXSMAX-512", + text: "iPhone XS, 512GB", + price: 1449 + } + ] + }, + { + name: "price", + title: "Price", + cellType: "expression", + expression: "getItemPrice('phone_model')", + displayStyle: "currency" + }, + { + name: "quantity", + title: "Quantity", + isRequired: true, + cellType: "text", + inputType: "number", + totalType: "sum", + totalFormat: "Total phones: {0}", + validators: [ + { + type: "numeric", + minValue: 1, + maxValue: 100 + } + ] + }, + { + name: "total", + title: "Total", + cellType: "expression", + expression: "{row.quantity} * {row.price}", + displayStyle: "currency", + totalType: "sum", + totalDisplayStyle: "currency", + totalFormat: "Total: {0}" + } + ] + }, + { + name: "vatProcents", + type: "text", + title: "VAT (in %)", + defaultValue: 20, + inputType: "number", + validators: [ + { + type: "numeric", + minValue: 0, + maxValue: 40 + } + ] + }, + { + name: "vatTotal", + type: "expression", + title: "VAT", + expression: "{orderList-total.total} * {vatProcents} / 100", + displayStyle: "currency", + startWithNewLine: false + }, + { + name: "total", + type: "expression", + title: "Total", + expression: "{orderList-total.total} + {vatTotal}", + displayStyle: "currency", + startWithNewLine: false + }, + { + type: "multipletext", + name: "pricelimit", + title: "Multipletext", + colCount: 2, + items: [ + { + name: "mostamount", + title: "Most amount you would every pay for a product like ours" + }, + { + name: "leastamount", + title: "The least amount you would feel comfortable paying" + } + ] + }, + { + type: "rating", + name: "satisfaction", + title: "Rating", + minRateDescription: "Not Satisfied", + maxRateDescription: "Completely satisfied" + }, + { + type: "comment", + name: "suggestions", + title: "Comment" + }, + { + type: "file", + title: "File", + name: "image", + storeDataAsText: false, + showPreview: true, + imageWidth: 150, + maxSize: 102400 + }, + { + type: "panel", + title: "Panel", + innerIndent: 1, + elements: [ + { + type: "checkbox", + choices: [ + { + value: "1", + text: "Customer relationship" + }, + { + value: "2", + text: "Service quality" + }, + { + value: "3", + text: "Support response time" + } + ], + name: "What should be improved?" + }, + { + type: "comment", + name: "suggestions", + title: "What would make you more satisfied with the Product?" + } + ] + }, + { + type: "paneldynamic", + name: "relatives", + title: "Panel Dynamic", + renderMode: "progressTop", + templateTitle: "Information about: {panel.relativeType}", + templateElements: [ + { + name: "relativeType", + type: "dropdown", + title: "Relative", + choices: [ + "father", + "mother", + "brother", + "sister", + "son", + "daughter" + ], + isRequired: true + }, + { + name: "isalive", + type: "radiogroup", + title: "Alive?", + startWithNewLine: false, + isRequired: true, + colCount: 0, + choices: ["Yes", "No"] + }, + { + name: "liveage", + type: "dropdown", + title: "Age", + isRequired: true, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'Yes'", + choicesMin: 1, + choicesMax: 115 + }, + { + name: "deceasedage", + type: "dropdown", + title: "Deceased Age", + isRequired: true, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'No'", + choices: [ + { + value: -1, + text: "Unknown" + } + ], + choicesMin: 1, + choicesMax: 115 + }, + { + name: "causeofdeathknown", + type: "radiogroup", + title: "Cause of Death Known?", + isRequired: true, + colCount: 0, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'No'", + choices: ["Yes", "No"] + }, + { + name: "causeofdeath", + type: "text", + title: "Cause of Death", + isRequired: true, + startWithNewLine: false, + visibleIf: + "{panel.isalive} = 'No' and {panel.causeofdeathknown} = 'Yes'" + }, + { + type: "panel", + name: "moreInfo", + state: "expanded", + title: "Detail Information about: {panel.relativeType}", + elements: [ + { + type: "matrixdynamic", + name: "relativeillness", + title: "Describe the illness or condition.", + rowCount: 0, + columns: [ + { + name: "illness", + cellType: "dropdown", + title: "Illness/Condition", + choices: [ + "Cancer", + "Heart Disease", + "Diabetes", + "Stroke/TIA", + "High Blood Pressure", + "High Cholesterol or Triglycerides", + "Liver Disease", + "Alcohol or Drug Abuse", + "Anxiety, Depression or Psychiatric Illness", + "Tuberculosis", + "Anesthesia Complications", + "Genetic Disorder", + "Other – describe" + ], + isRequired: true + }, + { + name: "description", + cellType: "text", + title: "Describe", + isRequired: true + } + ] + } + ] + } + ], + panelCount: 2, + panelAddText: "Add a blood relative", + panelRemoveText: "Remove the relative" + }, + { + type: "panel", + title: "Expression Example Panel", + innerIndent: 1, + elements: [ + { + type: "paneldynamic", + name: "items", + title: "Items", + keyName: "name", + showQuestionNumbers: "none", + templateTitle: "item #{panelIndex}", + templateElements: [ + { + type: "text", + name: "name", + title: "Name:", + isRequired: true + }, + { + type: "text", + name: "cost", + inputType: "number", + title: "Item Cost:", + isRequired: true, + startWithNewLine: false + }, + { + type: "text", + name: "vendor", + title: "Vendor:", + isRequired: true + }, + { + type: "text", + name: "quantity", + inputType: "number", + title: "Quantity:", + isRequired: true, + startWithNewLine: false + }, + { + type: "text", + name: "link", + title: "Link:", + isRequired: true + }, + { + type: "expression", + name: "total", + title: "Total Item Cost:", + expression: "{panel.cost} * {panel.quantity}", + displayStyle: "currency", + currency: "EUR", + startWithNewLine: false + } + ], + minPanelCount: 1, + panelAddText: "Add another item", + panelRemoveText: "Remove item" + }, + { + type: "panel", + title: "Totals", + elements: [ + { + type: "expression", + name: "totalQuantity", + title: "Total Quantity:", + expression: "sumInArray({items}, 'quantity'" + }, + { + type: "expression", + name: "totalCost", + title: "Total Cost:", + expression: "sumInArray({items}, 'total'", + displayStyle: "currency", + currency: "EUR", + startWithNewLine: false + } + ] + } + ] + } + ] +}; + +window.survey = new Survey.Model(json); +survey.onComplete.add(function (result) { + document.querySelector("#surveyResultElement").innerHTML = + "result: " + JSON.stringify(result.data); +}); + +window.addEventListener("DOMContentLoaded", () => { + SurveyUI.renderSurvey(survey, document.getElementById("surveyElement")); +}); + diff --git a/packages/survey-js-ui/karma.conf.js b/packages/survey-js-ui/karma.conf.js new file mode 100644 index 0000000000..9671b7b1e9 --- /dev/null +++ b/packages/survey-js-ui/karma.conf.js @@ -0,0 +1,88 @@ +const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); +const path = require("path"); +const packageJson = require("./package.json"); +const webpack = require("webpack"); +module.exports = function (config) { + config.set({ + basePath: "", + files: ["tests/markup.ts"], + frameworks: ["qunit"], + exclude: [], + mime: { + "text/x-typescript": ["ts", "tsx"] + }, + captureTimeout: 210000, + browserDisconnectTimeout: 100000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 100000, + junitReporter: { + outputDir: "tmp/testresults/", + outputFile: "test-results.xml" + }, + preprocessors: { + "**/*.ts": ["webpack", "sourcemap"] + }, + webpack: { + module: { + rules: [ + { + test: /\.(ts|tsx)$/, + loader: "ts-loader", + options: { + transpileOnly: false, + configFile: path.resolve(__dirname, "./tsconfig.tests.json") + } + }, + { + test: /\.html$/, + loader: "html-loader" + }, + ] + }, + resolve: { + extensions: [".ts", ".js", ".tsx", ".scss"], + alias: { + "react": path.resolve(__dirname, "./node_modules/preact/compat"), + "react-dom/test-utils": path.resolve(__dirname, "./node_modules/preact/test-utils"), + "react-dom": path.resolve(__dirname, "./node_modules/preact/compat"), + "react/jsx-runtime": path.resolve(__dirname, "./node_modules/preact/jsx-runtime"), + "survey-core": path.resolve(__dirname, "./node_modules/survey-core"), + "survey-core/icons/iconsV1": path.resolve(__dirname, "./node_modules/survey-core/icons/iconsV1"), + "survey-core/icons/iconsV2": path.resolve(__dirname, "./node_modules/survey-core/icons/iconsV2"), + "jquery": path.resolve(__dirname, "./node_modules/jquery"), + } + }, + plugins: [ + new webpack.DefinePlugin({ + "process.env.VERSION": JSON.stringify(packageJson.version) + }), + ] + }, + reporters: ["progress", "dots", "junit"], + browsers: ["ChromeHeadlessNoSandbox"], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: [ + "--no-sandbox", + "--disable-gpu", + "--no-default-browser-check", + "--no-first-run", + "--disable-default-apps", + "--disable-popup-blocking", + "--disable-translate", + "--disable-background-timer-throttling", + "--disable-renderer-backgrounding", + "--disable-device-discovery-notifications", + "--disable-web-security" + ] + } + }, + colors: true, + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_WARN, + autoWatch: true, + singleRun: false, + concurrency: Infinity + }); +}; \ No newline at end of file diff --git a/packages/survey-js-ui/package.json b/packages/survey-js-ui/package.json new file mode 100644 index 0000000000..c84033d807 --- /dev/null +++ b/packages/survey-js-ui/package.json @@ -0,0 +1,77 @@ +{ + "name": "survey-js-ui", + "version": "2.0.0", + "description": "", + "homepage": "https://surveyjs.io/Overview/Survey-Creator", + "author": "Devsoft Baltic OU", + "license": "SEE LICENSE IN LICENSE", + "repository": { + "type": "git", + "url": "https://github.com/surveyjs/survey-creator.git" + }, + "typings": "survey-js-ui.d.ts", + "scripts": { + "build": "webpack --env buildType=dev && webpack --env buildType=prod", + "watch:dev": "webpack --env buildType=dev --watch", + "test": "karma start ./karma.conf.js --single-run", + "test:watch": "karma start ./karma.conf.js", + "start": "webpack-dev-server --env buildType=dev --open", + "vrt": "testcafe ../../visualRegressionTests/ --app \"http-server --silent\" --screenshots ../../ --selector-timeout 1500 --reporter minimal --env=survey-js-ui --config-file ../../.testcaferc.dev.js", + "vrt:ci": "testcafe ../../visualRegressionTests/ --app \"http-server --silent\" --screenshots ../../ --selector-timeout 1500 --reporter minimal --env=survey-js-ui --config-file ../../.testcaferc.js", + "testcafe": "testcafe ../../functionalTests/ --app \"http-server --silent\" --env=survey-js-ui --config-file ../../.testcaferc.dev.js", + "testcafe:ci": "testcafe ../../functionalTests/ --app \"http-server --silent\" --reporter minimal --env=survey-js-ui --config-file ../../.testcaferc.js", + "accessibility-tests": "testcafe ../../accessibilityTests/ --app \"http-server --silent\" --screenshots ./ --selector-timeout 1500 --env=survey-js-ui --config-file ../../.testcaferc.dev.js", + "accessibility-tests:ci": "testcafe ../../accessibilityTests/ --app \"http-server --silent\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=survey-js-ui --config-file ../../.testcaferc.js", + "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" " + }, + "devDependencies": { + "@types/jquery": "3.3.29", + "@types/lodash": "4.14.186", + "@types/node": "7.0.4", + "@types/react": "^17.0.83", + "@types/react-dom": "^17.0.0", + "@types/qunit": "2.0.31", + "ajv": "8.17.1", + "chalk": "^3.0.0", + "colors": "1.4.0", + "concurrently": "^5.3.0", + "css-loader": "^7.1.2", + "dotenv": "4.0.0", + "eslint": "^7.32.0", + "get-func-name": "2.0.0", + "github-api": "^3.4.0", + "html-loader": "0.4.4", + "html-webpack-plugin": "^5.6.0", + "http-server": "^14.1.1", + "live-server": "^1.2.1", + "mini-css-extract-plugin": "^2.9.0", + "node-uuid": "1.4.7", + "replace-in-file": "^6.1.0", + "rimraf": "2.5.4", + "sass": "^1.62.1", + "sass-loader": "^8.0.2", + "shelljs": "^0.8.3", + "commit-and-tag-version": "^11.0.0", + "style-loader": "^1.2.1", + "surveyjs-doc-generator": "git+https://github.com/surveyjs/surveyjs-doc-generator.git", + "ts-loader": "^8.0.15", + "tsconfig-paths-webpack-plugin": "^3.3.0", + "typescript": "^4.8.0", + "url-loader": "^4.1.1", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4", + "jquery": "^3.5.1", + "puppeteer": "22.13.1", + "preact": "^10.21.0", + "karma": "^6.1.1", + "karma-chrome-launcher": "^3.1.0", + "karma-junit-reporter": "2.0.1", + "karma-qunit": "4.1.2", + "karma-sourcemap-loader": "0.3.8", + "karma-webpack": "5.0.0" + }, + "dependencies": { + "survey-core": "../survey-core/build" + } +} \ No newline at end of file diff --git a/packages/survey-js-ui/testCafe/countriesMock.json b/packages/survey-js-ui/testCafe/countriesMock.json new file mode 100644 index 0000000000..44a0728446 --- /dev/null +++ b/packages/survey-js-ui/testCafe/countriesMock.json @@ -0,0 +1,18 @@ +{ + "RestResponse": { + "result": [ + { + "alpha2_code": "US", + "name": "United States" + }, + { + "alpha2_code": "CU", + "name": "Cuba" + }, + { + "alpha2_code": "RO", + "name": "Romania" + } + ] + } +} \ No newline at end of file diff --git a/packages/survey-js-ui/testCafe/resources/big_Dashka.jpg b/packages/survey-js-ui/testCafe/resources/big_Dashka.jpg new file mode 100644 index 0000000000..697c6bc537 Binary files /dev/null and b/packages/survey-js-ui/testCafe/resources/big_Dashka.jpg differ diff --git a/packages/survey-js-ui/testCafe/resources/small_Dashka.jpg b/packages/survey-js-ui/testCafe/resources/small_Dashka.jpg new file mode 100644 index 0000000000..2dbeb92393 Binary files /dev/null and b/packages/survey-js-ui/testCafe/resources/small_Dashka.jpg differ diff --git a/packages/survey-js-ui/testCafe/resources/stub.txt b/packages/survey-js-ui/testCafe/resources/stub.txt new file mode 100644 index 0000000000..26fefde539 --- /dev/null +++ b/packages/survey-js-ui/testCafe/resources/stub.txt @@ -0,0 +1 @@ +Wombat \ No newline at end of file diff --git a/packages/survey-js-ui/tests/markup.ts b/packages/survey-js-ui/tests/markup.ts new file mode 100644 index 0000000000..bc7f19baa9 --- /dev/null +++ b/packages/survey-js-ui/tests/markup.ts @@ -0,0 +1,30 @@ + +import { testQuestionMarkup } from "../../../tests/markup/helper"; +import { markupTests } from "../../../tests/markup/etalon"; +// eslint-disable-next-line surveyjs/no-imports-from-entries +import * as SurveyUI from "../entries/index"; +import { Model } from "survey-core"; + +var platformDescriptor = { + name: "React", + survey: null, + surveyFactory: (json) => new Model(json), + render: (survey, element) => { + SurveyUI.renderSurvey(survey, element); + }, + getStrFromHtml: (snapshot) => { + return require("../../../tests/markup/snapshots/" + snapshot + ".snap.html"); + }, + finish: (element) => { + SurveyUI.unmountComponentAtNode(element); + } +}; + +export default QUnit.module("Base"); + +markupTests.forEach(markupTest => { + QUnit.test(markupTest.name, function (assert) { + testQuestionMarkup(assert, markupTest, platformDescriptor); + }); +}); + diff --git a/packages/survey-js-ui/tsconfig.json b/packages/survey-js-ui/tsconfig.json new file mode 100644 index 0000000000..11719c7779 --- /dev/null +++ b/packages/survey-js-ui/tsconfig.json @@ -0,0 +1,42 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es2015", + "lib": [ + "DOM", + "ES5", + "ES6", + "ES2015.Promise" + ], + "noImplicitAny": false, + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "importHelpers": false, + "moduleResolution": "node", + "jsx": "react", + "baseUrl": ".", + "declaration": true, + "declarationDir": "./build/typings", + "paths": { + "survey-core": [ + "./node_modules/survey-core" + ], + "survey-core/icons/iconsV1": [ + "./node_modules/survey-core/icons/iconsV1" + ], + "survey-core/icons/iconsV2": [ + "./node_modules/survey-core/icons/iconsV2" + ], + "react": [ + "./node_modules/@types/react" + ], + "react-dom": [ + "./node_modules/@types/react-dom" + ] + } + }, + "exclude": [], + "include": [ + "./entries/index.ts", + ], +} \ No newline at end of file diff --git a/packages/survey-js-ui/tsconfig.tests.json b/packages/survey-js-ui/tsconfig.tests.json new file mode 100644 index 0000000000..0636f4a2db --- /dev/null +++ b/packages/survey-js-ui/tsconfig.tests.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "declaration": false, + "declarationDir": null, + }, + "include": [ + "./tests/markup.ts", + ] +} \ No newline at end of file diff --git a/packages/survey-js-ui/webpack.config.js b/packages/survey-js-ui/webpack.config.js new file mode 100644 index 0000000000..07406050b8 --- /dev/null +++ b/packages/survey-js-ui/webpack.config.js @@ -0,0 +1,169 @@ +"use strict"; + +const webpack = require("webpack"); +const path = require("path"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +var DashedNamePlugin = require("../../build-scripts/webpack-dashed-name"); +const packageJson = require("./package.json"); +const fs = require("fs"); + +const year = new Date().getFullYear(); +const banner = [ + "surveyjs - Survey JavaScript library v" + packageJson.version, + "Copyright (c) 2015-" + year + " Devsoft Baltic OÜ - http://surveyjs.io/", + "License: MIT (http://www.opensource.org/licenses/mit-license.php)", +].join("\n"); + +const buildPlatformJson = { + "name": packageJson.name, + "version": packageJson.version, + "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.", + "keywords": [ + "Survey", + "JavaScript", + "Bootstrap", + "Library", + "jquery", + "jquery-plugin" + ], + "homepage": "https://surveyjs.io/", + "license": "MIT", + "files": [ + "**/*" + ], + "main": "survey-js-ui.js", + "repository": { + "type": "git", + "url": "https://github.com/surveyjs/surveyjs.git" + }, + "typings": "./typings/survey-js-ui/entries/index.d.ts", + "dependencies": {}, + "peerDependencies": { + "survey-core": packageJson.version, + "@types/react-dom": "*", + "@types/react": "*" + } +}; + +module.exports = function (options) { + const buildPath = __dirname + "/build/"; + const isProductionBuild = options.buildType === "prod"; + + const percentage_handler = function handler(percentage, msg) { + if (0 == percentage) { + console.log("Build started... good luck!"); + } else if (1 == percentage) { + if (isProductionBuild) { + fs.createReadStream("./README.md").pipe( + fs.createWriteStream(buildPath + "README.md") + ); + } + + if (isProductionBuild) { + fs.writeFileSync( + buildPath + "package.json", + JSON.stringify(buildPlatformJson, null, 2), + "utf8" + ); + } + } + }; + + const config = { + mode: isProductionBuild ? "production" : "development", + entry: { + [packageJson.name]: path.resolve(__dirname, "./entries/index.ts") + }, + resolve: { + extensions: [".ts", ".js", ".tsx", ".scss"], + alias: { + "react": path.resolve(__dirname, "./node_modules/preact/compat"), + "react-dom/test-utils": path.resolve(__dirname, "./node_modules/preact/test-utils"), + "react-dom": path.resolve(__dirname, "./node_modules/preact/compat"), + "react/jsx-runtime": path.resolve(__dirname, "./node_modules/preact/jsx-runtime"), + "survey-core/icons/iconsV1": path.resolve(__dirname, "./node_modules/survey-core/icons/iconsV1"), + "survey-core/icons/iconsV2": path.resolve(__dirname, "./node_modules/survey-core/icons/iconsV2"), + } + }, + optimization: { + minimize: isProductionBuild + }, + module: { + rules: [ + { + test: /\.(ts|tsx)$/, + loader: "ts-loader", + options: { + transpileOnly: isProductionBuild + } + }, + ] + }, + output: { + path: buildPath, + filename: "[name]" + (isProductionBuild ? ".min" : "") + ".js", + library: { + root: options.libraryName || "SurveyUI", + amd: '[dashedname]', + commonjs: '[dashedname]', + }, + libraryTarget: "umd", + globalObject: "this", + umdNamedDefine: true + }, + externals: [ + { + "survey-core": { + root: "Survey", + commonjs2: "survey-core", + commonjs: "survey-core", + amd: "survey-core" + }, + jquery: { + root: "jQuery", + commonjs2: "jquery", + commonjs: "jquery", + amd: "jquery" + }, + } + ], + plugins: [ + new DashedNamePlugin(), + new webpack.ProgressPlugin(percentage_handler), + new webpack.DefinePlugin({ + "process.env.VERSION": JSON.stringify(packageJson.version) + }), + new MiniCssExtractPlugin({ + filename: isProductionBuild ? "[name].min.css" : "[name].css" + }), + new webpack.BannerPlugin({ + banner: banner + }) + ] + }; + + if (isProductionBuild) { + config.plugins.push = config.plugins.concat([]); + } else { + config.devtool = "source-map"; + config.plugins = config.plugins.concat([ + new webpack.LoaderOptionsPlugin({ debug: true }), + new HtmlWebpackPlugin({ + filename: "index.html", + inject: "body", + template: "index.html" + }), + ]); + config.devServer = { + static: { + directory: path.join(__dirname, '.'), + }, + //host: "0.0.0.0", + compress: false, + port: 7777 + }; + } + + return config; +}; \ No newline at end of file diff --git a/packages/survey-react-ui/examples_test/customWidget/index.js b/packages/survey-react-ui/examples_test/customWidget/index.js deleted file mode 100644 index 03a0be1221..0000000000 --- a/packages/survey-react-ui/examples_test/customWidget/index.js +++ /dev/null @@ -1,4 +0,0 @@ -function init() { - Survey.StylesManager.applyTheme("default"); -} -document.addEventListener("DOMContentLoaded", init); \ No newline at end of file diff --git a/packages/survey-react-ui/examples_test/customWidget/react.html b/packages/survey-react-ui/examples_test/customWidget/react.html index f91cc2effd..7f32cfca69 100644 --- a/packages/survey-react-ui/examples_test/customWidget/react.html +++ b/packages/survey-react-ui/examples_test/customWidget/react.html @@ -4,20 +4,26 @@ Welcome to React - - - - - - - - - + + + + + + + + @@ -36,8 +42,7 @@ - - + diff --git a/packages/survey-react-ui/examples_test/defaultV2/react.html b/packages/survey-react-ui/examples_test/defaultV2/react.html index 339a043300..165ce3f59b 100644 --- a/packages/survey-react-ui/examples_test/defaultV2/react.html +++ b/packages/survey-react-ui/examples_test/defaultV2/react.html @@ -5,12 +5,18 @@ - - + + + + - - - diff --git a/packages/survey-react-ui/index.html b/packages/survey-react-ui/index.html new file mode 100644 index 0000000000..3ca9e4da88 --- /dev/null +++ b/packages/survey-react-ui/index.html @@ -0,0 +1,22 @@ + + + + + Welcome to React + + + + + + + + + + + +
+
+ + + + \ No newline at end of file diff --git a/packages/survey-react-ui/index.js b/packages/survey-react-ui/index.js new file mode 100644 index 0000000000..5b96f47744 --- /dev/null +++ b/packages/survey-react-ui/index.js @@ -0,0 +1,1078 @@ + +//Add the price property into choices +Survey.Serializer.addProperty("itemvalue", "price:number"); + +var getItemPrice = function (params) { + //this.row property available in cells of dropdown and dynamic matrices questions + var question = !!this.row + ? this.row.getQuestionByColumnName(params[0]) + : null; + //if we can't find a question inside the cell (by row and column name) then return + if (!question) return 0; + + //get the selected item/choice + var selItem = question.selectedItem; + //return 0 if a user did not select the item yet. + return !!selItem ? selItem.price : 0; +}; +//Register the custom function +Survey.FunctionFactory.Instance.register("getItemPrice", getItemPrice); + +var json = { + showProgressBar: "both", + description: "Survey Description", + title: "Survey New Design Test", + logo: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg", + logoPosition: "left", + questions: [ + { + name: "signature", + type: "signaturepad", + title: "Sign here", + isRequired: true + }, + { + name: "name", + type: "text", + title: "Text", + placeHolder: "Jon Snow", + isRequired: true + }, + { + name: "birthdate", + type: "text", + inputType: "date", + title: "Text Date", + isRequired: true + }, + { + name: "color", + type: "text", + inputType: "color", + title: "Text Color" + }, + { + name: "email", + type: "text", + inputType: "email", + title: "Text Email", + placeHolder: "jon.snow@nightwatch.org", + isRequired: true, + validators: [ + { + type: "email" + } + ] + }, + { + type: "dropdown", + name: "cars", + title: "Dropdown", + isRequired: true, + showNoneItem: true, + colCount: 4, + choices: [ + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "tagbox", + name: "cars2", + title: "Tagbox", + showNoneItem: true, + choices: [ + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "checkbox", + name: "car", + title: "Checkbox", + isRequired: true, + showNoneItem: true, + colCount: 4, + showSelectAllItem: true, + choices: [ + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "radiogroup", + name: "carss", + title: "Radiogroup", + isRequired: true, + colCount: 4, + choices: [ + "None", + "Ford", + "Vauxhall", + "Volkswagen", + "Nissan", + "Audi", + "Mercedes-Benz", + "BMW", + "Peugeot", + "Toyota", + "Citroen" + ] + }, + { + type: "image", + name: "banner", + imageHeight: "300px", + imageWidth: "450px", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg" + }, + { + type: "image", + name: "banner", + "contentMode": "video", + imageHeight: "300px", + imageWidth: "450px", + imageLink: + "https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4" + }, + { + type: "imagepicker", + name: "choosepicture", + title: "Imagepicker", + imageHeight: "150px", + imageWidth: "225px", + choices: [ + { + value: "lion", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg" + }, + { + value: "giraffe", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg" + }, + { + value: "panda", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg" + }, + { + value: "camel", + imageLink: + "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg" + } + ] + }, + { + type: "imagepicker", + name: "choosevideo", + title: "Imagepicker", + imageHeight: "300px", + imageWidth: "450px", + "contentMode": "video", + choices: [ + { + value: "short_but_high", + imageLink: + "https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4" + }, + { + value: "long_but_poor", + imageLink: + "https://sample-videos.com/video123/mp4/240/big_buck_bunny_240p_1mb.mp4" + } + ] + }, + { + type: "boolean", + name: "bool", + title: "Boolean", + label: "Are you 21 or older?", + isRequired: true + }, + { + type: "matrix", + name: "Quality", + title: "Matrix", + columns: [ + { + value: 1, + text: "Strongly Disagree" + }, + { + value: 2, + text: "Disagree" + }, + { + value: 3, + text: "Neutral" + }, + { + value: 4, + text: "Agree" + }, + { + value: 5, + text: "Strongly Agree" + } + ], + rows: [ + { + value: "affordable", + text: "Product is affordable" + }, + { + value: "does what it claims", + text: "Product does what it claims" + }, + { + value: "better than others", + text: "Product is better than other products on the market" + }, + { + value: "easy to use", + text: "Product is easy to use" + } + ] + }, + { + type: "matrix", + name: "planningPerformance", + title: "Matrix Rubric", + columns: [ + "Ineffective", + "Improvement Necessary", + "Effective", + "Highly Effective" + ], + rows: [ + { + value: "dataToPlan", + text: "Utilizes Assessment Data to Plan" + }, + { + value: "ambitiousGoals", + text: "Ambitious and Measurable Achievement Goal" + }, + { + value: "developsStandards", + text: + "Develops Standards.
Based Unit Plans and Assessments.
Evaluation Values." + }, + { + value: "createsObjective", + text: "Creates Objective - Driven Lesson Plans and Assessments" + } + ], + cells: { + dataToPlan: { + Ineffective: + "Teacher rarely or never uses formal and informal assessment data when planning", + "Improvement Necessary": + "Teacher uses formal and informal assessment data to formulate
- Achievement goals, unit plans, or lesson plans, but not all of these", + Effective: + "Teacher uses formal and informal assessment data to formulate
- Achievement goals, unit plans, and lesson plans", + "Highly Effective": + "Teacher uses formal and informal assessment data to formulate achievement goals, unit plans, and lesson plans
- Incorporates differentiated instructional strategies in planning to reach every student at his/her level of understanding" + }, + ambitiousGoals: { + Ineffective: + "Teacher rarely or never develops achievement goals for the class, or goals are developed but are too general to be helpful for planning purposes", + "Improvement Necessary": + "Teacher develops an annual student achievement goalthat lacks one or more of these traits:
- Measurable
- Aligned to content standards
- Includes benchmarks to help monitor learning and inform interventions throughout the year", + Effective: + "Teacher develops an annual student achievement goal that
- Is measurable
- Is aligned to content standards
- Includes benchmarks to help monitor learning and inform interventions throughout the year", + "Highly Effective": + "Teacher develops an annual student achievement goal that
- Is measurable
- Is aligned to content standards where applicable
- Includes benchmarks to help monitor learning and informinterventions throughout the year" + }, + developsStandards: { + Ineffective: + "Teacher rarely or never plans by identifying content standards that students will master in each unit, or there is little to no evidence that teacher plans units at all", + "Improvement Necessary": + "Based on achievement goals, teacher plans units but omits one or more of these steps:
- Identifying content standards that students will master in each unit
- Creating assessments before planning units
- Allocating an instructionally appropriate amount of time for each unit", + Effective: + "Based on achievement goals, teacher plans units by
- Identifying content standards that students will master in each unit
- Creating assessments before each unit begins for backwards planning
- Allocating an instructionally appropriate amount of time for each unit", + "Highly Effective": + "Based on achievement goals, teacher plans units by
- Identifying content standards that students will master in each unit
- Creating assessments before each unit begins for backwards planning
- Allocating an instructionally appropriate amount of time for each unit" + }, + createsObjective: { + Ineffective: + "Teacher rarely or never uses a system to track student assessment/progress data and/or has an ineffective grading system", + "Improvement Necessary": + "Teacher uses a data tracking system to record student assessment / progress data and maintain a grading system but fails in one or more of the following steps
- Use data to analyze student progress toward mastery or to plan future lessons / units
- Have a grading system that appropriately aligns with student learning goals", + Effective: + "Teacher uses an effective data tracking system for
- Recording student assessment / progress data
- Analyzing student progress towards mastery and planning future lessons/units accordingly
- Maintaining a grading system aligned to student learning goals", + "Highly Effective": + "Teacher uses an effective data tracking system that
- Records student assessment / progress data
- Analyzes student progress toward mastery and plans future lessons/units accordingly
- Maintains a grading system aligned to student learning goals" + } + } + }, + { + type: "matrix Dropdown", + name: "frameworksRate", + title: "Matrixdropdown", + choices: ["Excelent", "Good", "Average", "Fair", "Poor"], + columns: [ + { + name: "using", + title: "Do you use it?", + choices: ["Yes", "No"], + cellType: "radiogroup" + }, + { + name: "experience", + title: "How long do you use it?", + choices: [ + { + value: 5, + text: "3-5 years" + }, + { + value: 2, + text: "1-2 years" + }, + { + value: 1, + text: "less than a year" + } + ] + }, + { + name: "strength", + title: "What is main strength?", + choices: ["Easy", "Compact", "Fast", "Powerfull"], + cellType: "checkbox" + }, + { + name: "knowledge", + title: "Please describe your experience", + cellType: "text" + }, + { + name: "rate", + title: "Please rate the framework itself" + } + ], + rows: [ + { + value: "angularv1", + text: "angularjs v1.x" + }, + { + value: "angularv2", + text: "angularjs v2" + }, + { + value: "knockoutjs" + }, + { + value: "reactjs" + } + ] + }, + { + type: "matrixdynamic", + name: "teachersRate", + title: "Matrix Dynamic", + addRowText: "Add Subject", + horizontalScroll: true, + columnMinWidth: "130px", + columnColCount: 1, + cellType: "radiogroup", + choices: [ + { + value: 1, + text: "Yes" + }, + { + value: 0, + text: "Sometimes" + }, + { + value: -1, + text: "No" + } + ], + columns: [ + { + name: "subject", + cellType: "dropdown", + title: "Select a subject", + isRequired: true, + minWidth: "300px", + choices: [ + "English: American Literature", + "English: British and World Literature", + "Math: Consumer Math", + "Math: Practical Math", + "Math: Developmental Algebra", + "Math: Continuing Algebra", + "Math: Pre-Algebra", + "Math: Algebra", + "Math: Geometry", + "Math: Integrated Mathematics", + "Science: Physical Science", + "Science: Earth Science", + "Science: Biology", + "Science: Chemistry", + "History: World History", + "History: Modern World Studies", + "History: U.S. History", + "History: Modern U.S. History", + "Social Sciences: U.S. Government and Politics", + "Social Sciences: U.S. and Global Economics", + "World Languages: Spanish", + "World Languages: French", + "World Languages: German", + "World Languages: Latin", + "World Languages: Chinese", + "World Languages: Japanese" + ] + }, + { + name: "explains", + title: "Clearly explains the objectives" + }, + { + name: "interesting", + title: "Makes class interesting" + }, + { + name: "effective", + title: "Uses class time effectively" + }, + { + name: "knowledge", + title: "Knows the subject matter" + }, + { + name: "recognition", + title: "Recognizes and acknowledges effort" + }, + { + name: "inform", + title: "Keeps me informed of my progress" + }, + { + name: "opinion", + title: "Encourages and accepts different opinions" + }, + { + name: "respect", + title: "Has the respect of the student" + }, + { + name: "cooperation", + title: "Encourages cooperation and participation" + }, + { + name: "parents", + title: "Communicates with my parents" + }, + { + name: "selfthinking", + title: "Encourages me to think for myself" + }, + { + name: "frusturation", + cellType: "comment", + title: "Is there anything about this class that frustrates you?", + minWidth: "250px" + }, + { + name: "likeTheBest", + cellType: "comment", + title: "What do you like best about this class and/or teacher?", + minWidth: "250px" + }, + { + name: "improvements", + cellType: "comment", + title: + "What do you wish this teacher would do differently that would improve this class?", + minWidth: "250px" + } + ], + rowCount: 2 + }, + { + type: "matrixdynamic", + name: "Current Level of Function", + title: "Matrix Dynamic (vertical columns)", + columnLayout: "vertical", + minRowCount: 1, + maxRowCount: 5, + columns: [ + { + name: "Date", + title: "Date", + cellType: "text", + inputType: "date" + }, + { + name: "AmbDistance", + title: "Amb Distance", + cellType: "text" + }, + { + name: "Amb Assistance", + cellType: "dropdown", + choices: ["D", "MAX", "MOD", "MIN"] + }, + { + name: "Standing Tolerance", + cellType: "text" + }, + { + name: "UE Strength", + cellType: "text" + }, + { + name: "Cognitive Function", + cellType: "comment" + } + ], + choices: [1], + cellType: "comment", + confirmDelete: true, + addRowText: "Add Date +", + removeRowText: "Remove" + }, + { + type: "matrixdynamic", + name: "orderList", + rowCount: 1, + minRowCount: 1, + title: "Matrix Dynamic (totals)", + addRowText: "Add new item", + columns: [ + { + name: "id", + title: "Id", + cellType: "expression", + expression: "{rowIndex}" + }, + { + name: "phone_model", + title: "Phone model", + isRequired: true, + totalType: "count", + totalFormat: "Items count: {0}", + choices: [ + { + value: "iPhone7-32", + text: "iPhone 7, 32GB", + price: 449 + }, + { + value: "iPhone7-128", + text: "iPhone 7, 128GB", + price: 549 + }, + { + value: "iPhone7Plus-32", + text: "iPhone 7 Plus, 32GB", + price: 569 + }, + { + value: "iPhone7Plus-128", + text: "iPhone 7 Plus, 128GB", + price: 669 + }, + { + value: "iPhone8-64", + text: "iPhone 8, 64GB", + price: 599 + }, + { + value: "iPhone8-256", + text: "iPhone 8, 256GB", + price: 749 + }, + { + value: "iPhone8Plus-64", + text: "iPhone 8 Plus, 64GB", + price: 699 + }, + { + value: "iPhone8Plus-256", + text: "iPhone 8 Plus, 256GB", + price: 849 + }, + { + value: "iPhoneXR-64", + text: "iPhone XR, 64GB", + price: 749 + }, + { + value: "iPhoneXR-128", + text: "iPhone XR, 128GB", + price: 799 + }, + { + value: "iPhoneXR-256", + text: "iPhone XR, 256GB", + price: 899 + }, + { + value: "iPhoneXS-64", + text: "iPhone XS, 64GB", + price: 999 + }, + { + value: "iPhoneXS-256", + text: "iPhone XS, 256GB", + price: 1149 + }, + { + value: "iPhoneXS-512", + text: "iPhone XS, 512GB", + price: 1349 + }, + { + value: "iPhoneXSMAX-64", + text: "iPhone XS Max, 64GB", + price: 1099 + }, + { + value: "iPhoneXSMAX-256", + text: "iPhone XS Max, 256GB", + price: 1249 + }, + { + value: "iPhoneXSMAX-512", + text: "iPhone XS, 512GB", + price: 1449 + } + ] + }, + { + name: "price", + title: "Price", + cellType: "expression", + expression: "getItemPrice('phone_model')", + displayStyle: "currency" + }, + { + name: "quantity", + title: "Quantity", + isRequired: true, + cellType: "text", + inputType: "number", + totalType: "sum", + totalFormat: "Total phones: {0}", + validators: [ + { + type: "numeric", + minValue: 1, + maxValue: 100 + } + ] + }, + { + name: "total", + title: "Total", + cellType: "expression", + expression: "{row.quantity} * {row.price}", + displayStyle: "currency", + totalType: "sum", + totalDisplayStyle: "currency", + totalFormat: "Total: {0}" + } + ] + }, + { + name: "vatProcents", + type: "text", + title: "VAT (in %)", + defaultValue: 20, + inputType: "number", + validators: [ + { + type: "numeric", + minValue: 0, + maxValue: 40 + } + ] + }, + { + name: "vatTotal", + type: "expression", + title: "VAT", + expression: "{orderList-total.total} * {vatProcents} / 100", + displayStyle: "currency", + startWithNewLine: false + }, + { + name: "total", + type: "expression", + title: "Total", + expression: "{orderList-total.total} + {vatTotal}", + displayStyle: "currency", + startWithNewLine: false + }, + { + type: "multipletext", + name: "pricelimit", + title: "Multipletext", + colCount: 2, + items: [ + { + name: "mostamount", + title: "Most amount you would every pay for a product like ours" + }, + { + name: "leastamount", + title: "The least amount you would feel comfortable paying" + } + ] + }, + { + type: "rating", + name: "satisfaction", + title: "Rating", + minRateDescription: "Not Satisfied", + maxRateDescription: "Completely satisfied" + }, + { + type: "ranking", + name: "smartphone-features", + title: "Please rank the following smartphone features in order of importance:", + choices: [ + "Battery life", + "Screen size", + "Storage space", + "Camera quality", + "Durability", + "Processor power", + "Price", + ], + }, + { + type: "comment", + name: "suggestions", + title: "Comment" + }, + { + type: "file", + title: "File", + name: "image", + storeDataAsText: false, + showPreview: true, + imageWidth: 150, + maxSize: 102400 + }, + { + type: "panel", + title: "Panel", + innerIndent: 1, + state: "expanded", + elements: [ + { + type: "checkbox", + choices: [ + { + value: "1", + text: "Customer relationship" + }, + { + value: "2", + text: "Service quality" + }, + { + value: "3", + text: "Support response time" + } + ], + name: "What should be improved?" + }, + { + type: "comment", + name: "suggestions", + title: "What would make you more satisfied with the Product?" + } + ] + }, + { + type: "paneldynamic", + name: "relatives", + title: "Panel Dynamic", + renderMode: "progressTop", + templateTitle: "Information about: {panel.relativeType}", + templateElements: [ + { + name: "relativeType", + type: "dropdown", + title: "Relative", + choices: [ + "father", + "mother", + "brother", + "sister", + "son", + "daughter" + ], + isRequired: true + }, + { + name: "isalive", + type: "radiogroup", + title: "Alive?", + startWithNewLine: false, + isRequired: true, + colCount: 0, + choices: ["Yes", "No"] + }, + { + name: "liveage", + type: "dropdown", + title: "Age", + isRequired: true, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'Yes'", + choicesMin: 1, + choicesMax: 115 + }, + { + name: "deceasedage", + type: "dropdown", + title: "Deceased Age", + isRequired: true, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'No'", + choices: [ + { + value: -1, + text: "Unknown" + } + ], + choicesMin: 1, + choicesMax: 115 + }, + { + name: "causeofdeathknown", + type: "radiogroup", + title: "Cause of Death Known?", + isRequired: true, + colCount: 0, + startWithNewLine: false, + visibleIf: "{panel.isalive} = 'No'", + choices: ["Yes", "No"] + }, + { + name: "causeofdeath", + type: "text", + title: "Cause of Death", + isRequired: true, + startWithNewLine: false, + visibleIf: + "{panel.isalive} = 'No' and {panel.causeofdeathknown} = 'Yes'" + }, + { + type: "panel", + name: "moreInfo", + state: "expanded", + title: "Detail Information about: {panel.relativeType}", + elements: [ + { + type: "matrixdynamic", + name: "relativeillness", + title: "Describe the illness or condition.", + rowCount: 0, + columns: [ + { + name: "illness", + cellType: "dropdown", + title: "Illness/Condition", + choices: [ + "Cancer", + "Heart Disease", + "Diabetes", + "Stroke/TIA", + "High Blood Pressure", + "High Cholesterol or Triglycerides", + "Liver Disease", + "Alcohol or Drug Abuse", + "Anxiety, Depression or Psychiatric Illness", + "Tuberculosis", + "Anesthesia Complications", + "Genetic Disorder", + "Other – describe" + ], + isRequired: true + }, + { + name: "description", + cellType: "text", + title: "Describe", + isRequired: true + } + ] + } + ] + } + ], + panelCount: 2, + panelAddText: "Add a blood relative", + panelRemoveText: "Remove the relative" + }, + { + type: "panel", + title: "Expression Example Panel", + innerIndent: 1, + elements: [ + { + type: "paneldynamic", + name: "items", + title: "Items", + keyName: "name", + showQuestionNumbers: "none", + templateTitle: "item #{panelIndex}", + templateElements: [ + { + type: "text", + name: "name", + title: "Name:", + isRequired: true + }, + { + type: "text", + name: "cost", + inputType: "number", + title: "Item Cost:", + isRequired: true, + startWithNewLine: false + }, + { + type: "text", + name: "vendor", + title: "Vendor:", + isRequired: true + }, + { + type: "text", + name: "quantity", + inputType: "number", + title: "Quantity:", + isRequired: true, + startWithNewLine: false + }, + { + type: "text", + name: "link", + title: "Link:", + isRequired: true + }, + { + type: "expression", + name: "total", + title: "Total Item Cost:", + expression: "{panel.cost} * {panel.quantity}", + displayStyle: "currency", + currency: "EUR", + startWithNewLine: false + } + ], + minPanelCount: 1, + panelAddText: "Add another item", + panelRemoveText: "Remove item" + }, + { + type: "panel", + title: "Totals", + elements: [ + { + type: "expression", + name: "totalQuantity", + title: "Total Quantity:", + expression: "sumInArray({items}, 'quantity'" + }, + { + type: "expression", + name: "totalCost", + title: "Total Cost:", + expression: "sumInArray({items}, 'total'", + displayStyle: "currency", + currency: "EUR", + startWithNewLine: false + } + ] + } + ] + } + ] +}; + +// Survey.StylesManager.applyTheme("default"); +// Survey.StylesManager.applyTheme("modern"); +// Survey.StylesManager.applyTheme("defaultV2"); + +var model = new Survey.Model(json); +//model.setDesignMode(true); +window.survey = model; + +// class CustomTOCItem extends React.Component { +// constructor(props) { +// super(props); +// } +// render() { +// const survey = this.props.model.locOwner; +// const pageName = this.props.item.id; +// const page = survey.getPageByName(pageName); +// return ( +//
+// {page.title || page.name} +//
+// ); +// } +// } + +// SurveyReact.ReactElementFactory.Instance.registerElement( +// "sv-custom-toc-item", +// (props) => { +// return React.createElement(CustomTOCItem, props); +// } +// ); + +// model.findLayoutElement("toc-navigation").data.listModel.itemComponent = "sv-custom-toc-item"; + +model.onUploadFiles + .add(function (survey, options) { + options.callback("success", options.files.map(function (file) { + return { + file: file, + content: "https://surveyjs.io/Content/Images/design/Logo.svg" + }; + })); + }); + +ReactDOM.render( + , + document.getElementById("surveyElement") +); \ No newline at end of file diff --git a/packages/survey-react-ui/karma.conf.js b/packages/survey-react-ui/karma.conf.js new file mode 100644 index 0000000000..fb9219a5d7 --- /dev/null +++ b/packages/survey-react-ui/karma.conf.js @@ -0,0 +1,81 @@ +const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); +const path = require("path"); +const packageJson = require("./package.json"); +const webpack = require("webpack"); +module.exports = function (config) { + config.set({ + basePath: "", + files: ["tests/markup.ts"], + frameworks: ["qunit"], + exclude: [], + mime: { + "text/x-typescript": ["ts", "tsx"] + }, + captureTimeout: 210000, + browserDisconnectTimeout: 100000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 100000, + junitReporter: { + outputDir: "tmp/testresults/", + outputFile: "test-results.xml" + }, + preprocessors: { + "**/*.ts": ["webpack", "sourcemap"] + }, + webpack: { + module: { + rules: [ + { + test: /\.(ts|tsx)$/, + loader: "ts-loader", + options: { + transpileOnly: false, + configFile: path.resolve(__dirname, "./tsconfig.tests.json") + } + }, + { + test: /\.html$/, + loader: "html-loader" + }, + ] + }, + resolve: { + extensions: [".ts", ".js", ".tsx", ".scss"], + plugins: [ + new TsconfigPathsPlugin({ configFile: path.resolve(__dirname, "./tsconfig.tests.json") }) + ], + }, + plugins: [ + new webpack.DefinePlugin({ + "process.env.VERSION": JSON.stringify(packageJson.version) + }), + ] + }, + reporters: ["progress", "dots", "junit"], + browsers: ["ChromeHeadlessNoSandbox"], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: [ + "--no-sandbox", + "--disable-gpu", + "--no-default-browser-check", + "--no-first-run", + "--disable-default-apps", + "--disable-popup-blocking", + "--disable-translate", + "--disable-background-timer-throttling", + "--disable-renderer-backgrounding", + "--disable-device-discovery-notifications", + "--disable-web-security" + ] + } + }, + colors: true, + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_WARN, + autoWatch: true, + singleRun: false, + concurrency: Infinity + }); +}; \ No newline at end of file diff --git a/packages/survey-react-ui/package.json b/packages/survey-react-ui/package.json index 0ce7142f64..3cb2d0c08b 100644 --- a/packages/survey-react-ui/package.json +++ b/packages/survey-react-ui/package.json @@ -21,39 +21,36 @@ }, "scripts": { "build": "webpack --env buildType=dev && webpack --env buildType=prod", - "testcafe": "testcafe chrome ../../testCafe/ --selector-timeout 1500 --app \"http-server --silent\" --env=react", - "testcafe:ci": "testcafe chrome:headless -c 4 -q attemptLimit=5,successThreshold=1 ../../testCafe/ --selector-timeout 1500 --app \"http-server --silent\" --env=react", - "testcafe:a11y": "testcafe chrome ./accessibilityTests/ --app \"http-server\" --screenshots ./ --reporter minimal --selector-timeout 1500 --env=react", - "testcafe:a11y:ci": "testcafe chrome:headeless -c 4 -q ./accessibilityTests/ --app \"http-server\" --screenshots ./ --reporter minimal --selector-timeout 1500 --env=react", - "visual-regression-tests": "testcafe chrome --disable-font-subpixel-positioning ../../visualRegressionTests/ --app \"http-server\" --screenshots ../../ --selector-timeout 1500 --env=react", - "visual-regression-tests:ci": "testcafe chrome:headless -c 4 -q attemptLimit=5,successThreshold=1 --disable-font-subpixel-positioning ../../visualRegressionTests/ --app \"http-server\" --screenshots ../../ --selector-timeout 1500 --env=react" + "watch:dev": "webpack --env buildType=dev --watch", + "start": "webpack-dev-server --env buildType=dev --open", + "test": "karma start ./karma.conf.js --single-run", + "test:watch": "karma start ./karma.conf.js", + "testcafe": "testcafe ../../functionalTests/ --selector-timeout 1500 --app \"http-server --silent\" --env=react --config-file ../../.testcaferc.dev.js", + "testcafe:ci": "testcafe ../../functionalTests/ --selector-timeout 1500 --app \"http-server --silent\" --reporter minimal --env=react --config-file ../../.testcaferc.js", + "vrt": "testcafe ../../visualRegressionTests/ --app \"http-server --silent\" --screenshots ../../ --selector-timeout 1500 --env=react --config-file ../../.testcaferc.dev.js", + "vrt:ci": "testcafe ../../visualRegressionTests/ --app \"http-server --silent\" --screenshots ../../ --selector-timeout 1500 --reporter minimal --env=react --config-file ../../.testcaferc.js", + "accessibility-tests": "testcafe ../../accessibilityTests/ --app \"http-server --silent\" --screenshots ./ --selector-timeout 1500 --env=react --config-file ../../.testcaferc.dev.js", + "accessibility-tests:ci": "testcafe ../../accessibilityTests/ --app \"http-server --silent\" --screenshots ./ --selector-timeout 1500 --reporter minimal --env=react --config-file ../../.testcaferc.js", + "release": "commit-and-tag-version --message \"Release: %s [azurepipelines skip]\" " }, "typings": "./typings/src/entries/react-ui.d.ts", "devDependencies": { - "@types/babel__traverse": "7.18.2", - "@types/jest": "^26.0.24", + "@types/qunit": "2.0.31", "@types/lodash": "4.14.186", "@types/node": "7.0.4", "@types/react": "^17.0.83", "@types/react-dom": "^17.0.1", "@types/react-test-renderer": "^17.0.1", "ajv": "8.17.1", - "axe-core": "^3.5.6", - "axe-testcafe": "latest", "chalk": "^3.0.0", "colors": "1.4.0", "concurrently": "^5.3.0", "css-loader": "^7.1.2", - "devextreme-screenshot-comparer": "^2.0.11", "dotenv": "4.0.0", "eslint": "^7.32.0", "html-webpack-plugin": "^5.6.0", "http-server": "^14.1.1", - "jest": "^29.7.0", - "jest-canvas-mock": "^2.3.1", - "jest-environment-jsdom": "^29.7.0", "mini-css-extract-plugin": "^2.9.0", - "node-uuid": "1.4.7", "react": "^17.0.1", "react-dom": "^17.0.1", "react-test-renderer": "^17.0.1", @@ -61,18 +58,22 @@ "sass": "^1.62.1", "sass-loader": "^8.0.2", "shelljs": "^0.8.3", - "standard-version": "^9.5.0", + "commit-and-tag-version": "^11.0.0", "style-loader": "^1.2.1", - "survey-core": "../../build/survey-core", - "surveyjs-doc-generator": "git+https://github.com/surveyjs/surveyjs-doc-generator.git", - "testcafe": "3.6.2", - "ts-jest": "^29.2.2", + "survey-core": "../survey-core/build", "ts-loader": "^8.0.15", "tsconfig-paths-webpack-plugin": "^3.3.0", "typescript": "^4.8.0", "url-loader": "^4.1.1", "webpack": "^5.93.0", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.0.4" + "webpack-dev-server": "^5.0.4", + "karma": "^6.1.1", + "karma-chrome-launcher": "^3.1.0", + "karma-junit-reporter": "2.0.1", + "karma-qunit": "4.1.2", + "karma-sourcemap-loader": "0.3.8", + "karma-webpack": "5.0.0", + "html-loader": "0.4.4" } } \ No newline at end of file diff --git a/packages/survey-react-ui/src/imagepicker.tsx b/packages/survey-react-ui/src/imagepicker.tsx index 5656b087cc..6f40b10243 100644 --- a/packages/survey-react-ui/src/imagepicker.tsx +++ b/packages/survey-react-ui/src/imagepicker.tsx @@ -210,7 +210,7 @@ export class SurveyQuestionImagePickerItem extends ReactSurveyElement {
{!!this.question.cssClasses.checkedItemDecorator ? - + : null} {control} diff --git a/packages/survey-react-ui/src/reactSurvey.tsx b/packages/survey-react-ui/src/reactSurvey.tsx index a9e59e4c09..46fb813d35 100644 --- a/packages/survey-react-ui/src/reactSurvey.tsx +++ b/packages/survey-react-ui/src/reactSurvey.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { Base, Question, PageModel, SurveyError, StylesManager, surveyCss, Helpers, doKey2ClickUp, SurveyModel, doKey2ClickBlur, doKey2ClickDown, IAttachKey2clickOptions, SvgRegistry, addIconsToThemeSet } from "survey-core"; +import { Base, Question, PageModel, SurveyError, Helpers, doKey2ClickUp, SurveyModel, doKey2ClickBlur, doKey2ClickDown, IAttachKey2clickOptions, SvgRegistry, addIconsToThemeSet } from "survey-core"; import { SurveyPage } from "./page"; import { ISurveyCreator } from "./reactquestion"; import { SurveyElementBase } from "./reactquestion_element"; @@ -12,8 +12,8 @@ import { ComponentsContainer } from "./components/components-container"; import { SvgBundleComponent } from "./svgbundle"; import { PopupModal } from "./components/popup/popup-modal"; -import { icons as iconsV1 } from "@coreIconsV1"; -import { icons as iconsV2 } from "@coreIconsV2"; +import { icons as iconsV1 } from "survey-core/icons/iconsV1"; +import { icons as iconsV2 } from "survey-core/icons/iconsV2"; addIconsToThemeSet("v1", iconsV1); addIconsToThemeSet("v2", iconsV2); SvgRegistry.registerIcons(iconsV1); @@ -21,12 +21,6 @@ export class Survey extends SurveyElementBase implements ISurveyCreator { private previousJSON = {}; private rootRef: React.RefObject; - public static get cssType(): string { - return surveyCss.currentType; - } - public static set cssType(value: string) { - StylesManager.applyTheme(value); - } protected survey: SurveyModel; private rootNodeId: string; // root dom node ID attr diff --git a/packages/survey-react-ui/src/reactquestion_element.tsx b/packages/survey-react-ui/src/reactquestion_element.tsx index a94651f5aa..f8f1172e8c 100644 --- a/packages/survey-react-ui/src/reactquestion_element.tsx +++ b/packages/survey-react-ui/src/reactquestion_element.tsx @@ -34,7 +34,7 @@ export class SurveyElementBase extends React.Component { componentDidUpdate(prevProps: any, prevState: any) { this.makeBaseElementsReact(); const stateElements = this.getStateElements(); - this.disableStateElementsRerenderEvent((this.prevStateElements ?? []).filter(el => !stateElements.includes(el))); + this.disableStateElementsRerenderEvent((this.prevStateElements ?? []).filter(el => !stateElements.find(stateElement => stateElement == el))); this.prevStateElements = []; this.getStateElements().forEach((el) => { el.afterRerender(); diff --git a/packages/survey-react-ui/testCafe/countriesMock.json b/packages/survey-react-ui/testCafe/countriesMock.json new file mode 100644 index 0000000000..44a0728446 --- /dev/null +++ b/packages/survey-react-ui/testCafe/countriesMock.json @@ -0,0 +1,18 @@ +{ + "RestResponse": { + "result": [ + { + "alpha2_code": "US", + "name": "United States" + }, + { + "alpha2_code": "CU", + "name": "Cuba" + }, + { + "alpha2_code": "RO", + "name": "Romania" + } + ] + } +} \ No newline at end of file diff --git a/packages/survey-react-ui/testCafe/resources/big_Dashka.jpg b/packages/survey-react-ui/testCafe/resources/big_Dashka.jpg new file mode 100644 index 0000000000..697c6bc537 Binary files /dev/null and b/packages/survey-react-ui/testCafe/resources/big_Dashka.jpg differ diff --git a/packages/survey-react-ui/testCafe/resources/small_Dashka.jpg b/packages/survey-react-ui/testCafe/resources/small_Dashka.jpg new file mode 100644 index 0000000000..2dbeb92393 Binary files /dev/null and b/packages/survey-react-ui/testCafe/resources/small_Dashka.jpg differ diff --git a/packages/survey-react-ui/testCafe/resources/stub.txt b/packages/survey-react-ui/testCafe/resources/stub.txt new file mode 100644 index 0000000000..26fefde539 --- /dev/null +++ b/packages/survey-react-ui/testCafe/resources/stub.txt @@ -0,0 +1 @@ +Wombat \ No newline at end of file diff --git a/tests/markup/question_react_tests.ts b/packages/survey-react-ui/tests/markup.ts similarity index 68% rename from tests/markup/question_react_tests.ts rename to packages/survey-react-ui/tests/markup.ts index ac94f45071..a83c80dd43 100644 --- a/tests/markup/question_react_tests.ts +++ b/packages/survey-react-ui/tests/markup.ts @@ -1,8 +1,9 @@ -import { testQuestionMarkup } from "./helper"; -import { markupTests } from "./etalon"; +import { testQuestionMarkup } from "../../../tests/markup/helper"; +import { markupTests } from "../../../tests/markup/etalon"; // eslint-disable-next-line surveyjs/no-imports-from-entries -import { Model as ReactModel, Survey as SurveyReact } from "../../src/entries/react"; +import { Survey as SurveyReact } from "../entries/index"; +import { Model } from "survey-core"; import { act } from "react-dom/test-utils"; import React from "react"; import ReactDOM from "react-dom"; @@ -10,7 +11,7 @@ import ReactDOM from "react-dom"; var platformDescriptor = { name: "React", survey: null, - surveyFactory: (json) => new ReactModel(json), + surveyFactory: (json) => new Model(json), render: (survey, element) => { var component = React.createElement(SurveyReact, { model: survey }, null); act(() => { @@ -21,7 +22,7 @@ var platformDescriptor = { }); }, getStrFromHtml: (snapshot) => { - return require("./snapshots/" + snapshot + ".snap.html"); + return require("../../../tests/markup/snapshots/" + snapshot + ".snap.html"); }, finish: (element) => { ReactDOM.unmountComponentAtNode(element); diff --git a/packages/survey-react-ui/tsconfig.json b/packages/survey-react-ui/tsconfig.json index 40dd2b2552..4b319224fb 100644 --- a/packages/survey-react-ui/tsconfig.json +++ b/packages/survey-react-ui/tsconfig.json @@ -14,7 +14,7 @@ "experimentalDecorators": true, "importHelpers": true, "moduleResolution": "node", - "jsx": "react-jsx", + "jsx": "react", "baseUrl": ".", "declaration": true, "declarationDir": "build/typings/" diff --git a/packages/survey-react-ui/tsconfig.tests.json b/packages/survey-react-ui/tsconfig.tests.json new file mode 100644 index 0000000000..3eefeee6fa --- /dev/null +++ b/packages/survey-react-ui/tsconfig.tests.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "survey-core": [ + "./node_modules/survey-core" + ], + }, + "declaration": false, + "declarationDir": null, + }, + "include": [ + "./tests/markup.ts", + ] +} \ No newline at end of file diff --git a/packages/survey-react-ui/webpack.config.js b/packages/survey-react-ui/webpack.config.js index ecb0ba6ebf..70285d73e8 100644 --- a/packages/survey-react-ui/webpack.config.js +++ b/packages/survey-react-ui/webpack.config.js @@ -35,7 +35,7 @@ const buildPlatformJson = { typings: "./typings/entries/index.d.ts", "peerDependencies": { - "survey-core": "*", + "survey-core": packageJson.version, "react": "^16.5.0 || ^17.0.1 || ^18.2.0", "react-dom": "^16.5.0 || ^17.0.1 || ^18.2.0" } @@ -106,11 +106,6 @@ module.exports = function (options) { } ] }, - // { - // test: /\.html$/, - // exclude: [/node_modules/, require.resolve('./index.html')], - // loader: "html-loader" - // }, { test: /\.(svg|png)$/, use: { @@ -156,7 +151,6 @@ module.exports = function (options) { new DashedNamePlugin(), new webpack.ProgressPlugin(percentage_handler), new webpack.DefinePlugin({ - "process.env.ENVIRONMENT": JSON.stringify(options.buildType), "process.env.VERSION": JSON.stringify(packageJson.version) }), new MiniCssExtractPlugin({ @@ -174,20 +168,20 @@ module.exports = function (options) { config.devtool = "source-map"; config.plugins = config.plugins.concat([ new webpack.LoaderOptionsPlugin({ debug: true }), - // new HtmlWebpackPlugin({ - // filename: "index.html", - // inject: "body", - // template: "index.html" - // }), + new HtmlWebpackPlugin({ + filename: "index.html", + inject: "body", + template: "index.html" + }), ]); - // config.devServer = { - // static: { - // directory: path.join(__dirname, '.'), - // }, - // //host: "0.0.0.0", - // compress: false, - // port: 8082 - // }; + config.devServer = { + static: { + directory: path.join(__dirname, '.'), + }, + //host: "0.0.0.0", + compress: false, + port: 7777 + }; } return config; diff --git a/packages/survey-vue3-ui/CHANGELOG.md b/packages/survey-vue3-ui/CHANGELOG.md index c48b3ebfa0..83af6ffd76 100644 --- a/packages/survey-vue3-ui/CHANGELOG.md +++ b/packages/survey-vue3-ui/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.12.17](https://github.com/surveyjs/survey-library/compare/v1.12.16...v1.12.17) (2024-12-30) + ## [1.12.16](https://github.com/surveyjs/survey-library/compare/v1.12.15...v1.12.16) (2024-12-24) ## [1.12.15](https://github.com/surveyjs/survey-library/compare/v1.12.14...v1.12.15) (2024-12-17) diff --git a/packages/survey-vue3-ui/example/package.json b/packages/survey-vue3-ui/example/package.json index 4c8ecd5ce1..de7b64e36b 100644 --- a/packages/survey-vue3-ui/example/package.json +++ b/packages/survey-vue3-ui/example/package.json @@ -11,10 +11,9 @@ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" }, "dependencies": { - "bootstrap": "^3.3.7", "showdown": "^1.6.4", - "survey-core": "../../../build/survey-core", - "survey-vue3-ui": "../../../build/survey-vue3-ui", + "survey-core": "../../survey-core/build", + "survey-vue3-ui": "../build", "surveyjs-widgets": "^1.9.40", "vue": "3.4.19", "vue-router": "^4.2.2" diff --git a/packages/survey-vue3-ui/example/src/components/test/Test.vue b/packages/survey-vue3-ui/example/src/components/test/Test.vue index 8b7b5de005..f39b637521 100644 --- a/packages/survey-vue3-ui/example/src/components/test/Test.vue +++ b/packages/survey-vue3-ui/example/src/components/test/Test.vue @@ -1,16 +1,11 @@