Compare commits

...
Author SHA1 Message Date
Matteo e6a838708c fix(web): layer the test helpers instead of adding a package for them
Drops `@ownclouders/web-test-helpers-core` again and keeps the workspace
graph acyclic by layering the helpers onto the packages that already need
them:

  design-system/testing  mount/shallowMount, prop types, design system +
                         gettext + router-link stub plugins
  web-pkg/src/testing    the above, extended with casl abilities, mocked
                         pinia stores and component mocks
  web-test-helpers       re-export of web-pkg/src/testing

design-system sits at the bottom of the graph, so it cannot depend on a
package that installs it - hence the generic half lives there. web-pkg
composes those plugins rather than duplicating them, so every helper is
still defined exactly once, and no package depends on one above it.

The public API of `@ownclouders/web-test-helpers` is unchanged, so
external extensions are unaffected. This also removes the testing package
from web-pkg's runtime dependencies, the module-level plugin registry and
the two public-hoist entries in .npmrc.

Two fixes to the published artifacts, both verified by mounting through
the built bundles the way an external extension resolves them:

- keep `@ownclouders/design-system/testing` external in web-pkg's lib
  build. rollup matches `external` strings exactly, so the subpath was
  inlined, shipping a second copy of the design system and of
  @vue/test-utils - components and wrappers were then not identity-equal
  to the consumer's own, and gettext injection broke.
- name the web-test-helpers umd output `.cjs`. The package is ESM, so the
  `.js` file that publishConfig.exports pointed `require` at could not be
  required.
2026-09-21 17:45:49 +02:00
Matteo fb72f45e10 ci(web): scope lint and unit tests to affected projects on normal PRs (Phase 3)
Adds a `full-run` output to detect-web-changes: true for push to
master/stable-* or a `[full-ci]` PR title (the two cases that already
always ran everything), false for a normal PR. web-build-test's Lint
and Run unit tests steps branch on it - full-run keeps calling `pnpm
lint` / `pnpm test:unit --coverage` exactly as before (zero behavior
change for those two cases); a normal PR instead runs `nx affected -t
lint` / `nx affected -t test --base=<PR base sha>`, scoped to only
what the PR could actually break.

Two things deliberately NOT switched to `nx affected`, both for
reasons already hit while building phases 1/2a/2b:

- Check types stays `pnpm check:types` (whole-repo), unconditional,
  every run. Only 5/27 projects have a real per-project `typecheck`
  target (needs a project's own vite.config.ts; most web-app-*
  packages only have a vitest.config.ts) - affected-scoping typecheck
  would silently skip the other 22.
- Run unit tests' full-run path keeps `pnpm test:unit --coverage`
  producing one aggregated lcov report, not `nx run-many -t test`
  (which would split it into 16 per-project reports with no merge
  step - the same gap flagged and deliberately left alone in Phase 1).
  The affected-scoped PR path has no such expectation to preserve, so
  it can safely use the per-project reports as-is.

Added fetch-depth: 0 to web-build-test's checkout (missing before;
needed for `nx affected --base=<sha>` to find that commit).

Verified: workflow YAML parses; `nx affected -t lint --base=HEAD` (zero
diff) exits 0 with "No tasks were run" rather than failing; `pnpm exec
nx affected -t lint --base=<a real prior commit>` (the exact invocation
used in the workflow) runs and passes for all 26 projects.
2026-09-21 17:45:47 +02:00
Matteo 3893ce2e5c feat(web): add per-project lint and typecheck targets (Phase 2a+2b)
Phase 2a - lint, via @nx/eslint/plugin (correct subpath; the bare
package name silently produces zero targets - same gotcha as
@nx/vitest before it). Despite there being only one shared root
eslint.config.js and no per-package configs, the plugin's glob also
matches every package.json, so it still creates a real per-project
"lint" target for all 26 projects, each scoped to just that project's
files. Root `lint` script untouched.

Verified: nx run-many -t lint succeeds for all 26 projects (exit 0 -
same "warnings don't fail the run" semantics as the existing root
lint); root `pnpm run lint`/`check:format` still pass unchanged.

Phase 2b - typecheck, via @nx/vite/plugin's typecheckTargetName
(a Vite-specific plugin, distinct from the build/serve/preview targets
it also wants to create - those are pointed at unused names, since
this repo builds everything through one root vite.config.ts rather
than per-package, so auto-generated per-package build/serve targets
would be noise, not signal).

This one is genuinely partial, matching the spec's own "fragile,
spike-gated" flag for this phase: the plugin only creates a typecheck
target for projects with their own real vite.config.ts - design-system,
web-client, web-pkg, web-test-helpers, web-test-helpers-core (5 of 27).
The other ~20 web-app-*/web-runtime projects only have a vitest.config.ts
(they're bundled together, not built independently), which this plugin
doesn't pick up for typecheck at all. Extending coverage to them would
mean either giving each its own vite.config.ts or splitting the shared
tsconfig into real TS project references - both bigger, riskier changes
not attempted here. Root `pnpm run check:types` (whole-repo vue-tsc,
unchanged) stays the one check that covers everything; the 5 new
per-project targets are an additive convenience on top, not a
replacement.

Verified: nx run-many -t typecheck succeeds for all 5 registered
projects; a deliberately injected type error in web-pkg/src/index.ts
was caught correctly (TS2322, exit 1) and reverted; root
`pnpm run check:types` (vue-tsc --noEmit, synchronous, real captured
exit code) still passes clean, 0 errors.
2026-09-21 17:45:46 +02:00
Matteo 147b19d4ff fix(web): remove design-system's broken "lint" script alias
"lint": "lint:stylelint" tries to exec a binary literally named
"lint:stylelint", which doesn't exist - it needed "npm run"/"pnpm run"
to actually invoke the script by that name. Pre-existing, unrelated to
any Nx work: the root `lint` script never delegates per-package (it
globs the whole workspace directly with eslint), and nothing in CI
calls `pnpm --filter design-system run lint` either, so this has never
been exercised.

Also discovered `lint:stylelint` itself has never successfully run -
it's missing the `postcss-scss` dependency stylelint's SCSS custom
syntax needs (Cannot find package 'postcss-scss', reproduces identically
outside of Nx). That's a separate, deeper pre-existing gap, left alone.

Removed the alias entirely rather than fixing it in place: nothing
currently calls it, and Nx's per-project lint target (next commit)
needs the "lint" name free to create a real ESLint-backed target for
this package, same as every other one.
2026-09-21 17:45:46 +02:00
Matteo 9f91522d76 feat(web): add per-project test targets via @nx/vitest (Phase 1)
Registers @nx/vitest's inference plugin so every package with a
vitest.config.ts gets a real, cached "test" target read directly from
its own config - not just the 15/24 packages that happened to already
declare a "test:unit" npm script (Phase 0's target).

- @nx/vite was the wrong package for this (it only infers
  build/serve/preview/typecheck targets, never test) - replaced with
  @nx/vitest.
- The plugin's default file glob (**/{vite,vitest}.config.*) also
  matches vite.config.common.ts (a plain compiler-options module, not
  a Vite config) and the root vite.config.ts (the app bundler, not a
  test config); loading either as a test config throws and aborts the
  whole project graph. Excluded both, plus vite.cern.config.ts for the
  same reason.
- defaultBase: "master" - bare `nx affected` defaults to comparing
  against a branch named "main"; ocis's default branch is "master",
  so without this every affected/dry-run invocation errored with
  "ambiguous argument 'main': unknown revision".
- analytics: false - written by the nx CLI itself the first time it
  ran interactively; disabling Nx's own usage telemetry, no Nx Cloud
  token/URL configured anywhere (matches Phase 0's "local cache only"
  decision).

Deliberately NOT changed: the root "test:unit" script. `nx run-many -t
test` runs each project as its own vitest process, writing coverage to
{workspaceRoot}/coverage/{projectRoot} per project - not the single
aggregated lcov report `pnpm test:unit --coverage` produces today.
Nothing currently consumes that aggregate (no codecov config, no
upload step in web-tests.yml), but flipping the script would still be
a real behavior change with no aggregation story yet, so left it
alone. `nx affected -t test` / `nx run-many -t test` are additional
commands, not a replacement, until that's worth solving.

Verified: nx run-many -t test succeeds for all 16 vitest projects
(matches individual project counts from earlier verification exactly);
nx run <project>:test caches correctly (1/1 hit on rerun); nx show
projects --affected --files=... still resolves to the exact same 2
projects as before (web-app-search, web-app-files) - the new plugin
doesn't change affected-detection accuracy; nx affected -t test
--uncommitted correctly scopes to just the 2 dependent projects on an
isolated single-file edit once defaultBase is set.

Also set testMode: "run" on the plugin. Without it, `nx run
<project>:test` uses vitest's default watch mode locally (only
auto-switches to run-once in CI), leaving the terminal waiting for
input (press q to exit) - not what you want from a one-shot command.
2026-09-21 17:45:45 +02:00
Matteo bbb3ed25d7 fix(web): cast wrapper.vm to any before spying on a script-setup binding
triggerUpload is a <script setup> binding, not part of the public
component instance type, so TS2345 fails vue-tsc --noEmit. Pre-existing,
unrelated to the cycle/Nx work in the prior two commits - found while
re-verifying the full typecheck.
2026-09-21 17:45:45 +02:00
Matteo 81844d6b26 feat(web): add Nx as task orchestrator (Phase 0 foundation)
Introduces Nx on top of the existing pnpm workspace, no behavior
change to any existing script.

- Add nx (^23.2.1) as a workspace devDependency
- Add nx.json with a targetDefaults entry for test:unit (cache: true)
- Ignore .nx/cache and .nx/workspace-data

Nx auto-discovers all 25 real projects (24 packages + e2e) from the
pnpm workspace with no plugin config needed. Of those, test:unit is
the only target with genuine existing per-project granularity today
(15/24 packages declare their own script) - lint/check:types/build
stay monolithic root scripts for now, per the phased plan.

The root package.json intentionally does not become an Nx project:
Nx doesn't turn the directory holding nx.json into a project, and
there's no source tree of its own for other projects to be "affected
by" - root's remaining scripts (build, licenses:check, check:format)
stay whole-repo, invoked directly, matching the target model in the
design doc.

Verified: nx run @ownclouders/web-pkg:test:unit cold (80s, 0/1 cache
hit, 159 files passed) then unchanged (116ms, 1/1 cache hit, identical
results); a touched file correctly invalidated the cache (0/1 hit).
Root lint and check:types still pass clean, untouched.
2026-09-21 17:45:44 +02:00
Matteo 75d9af7d92 fix(web): break web-pkg/web-test-helpers/design-system dep cycle without changing the published API
The workspace package graph had one strongly connected component:
{web-pkg, web-test-helpers, design-system}. web-pkg and design-system
depend on web-test-helpers for testing; web-test-helpers depended back
on both (design-system for the real DesignSystem Vue plugin, web-pkg
for types used by its own mocks). pnpm already warned about this
("cyclic workspace dependencies"); it also blocks giving these
packages a cached Nx build target with dependsOn: ["^build"].

An earlier attempt at this fix moved the web-pkg-coupled mocks out of
@ownclouders/web-test-helpers and into a new @ownclouders/web-pkg/src
subpath, removing them from web-test-helpers' public exports. That is
a breaking change for the 17 published web-extensions packages that
depend on @ownclouders/web-test-helpers (^12.5.0) - and a silent one,
since defaultPlugins() would only throw at test-run time.

This does the same structural fix without touching the public API:

- New @ownclouders/web-test-helpers-core: everything generic (mount,
  shallowMount, getComposableWrapper, defaultStubs, httpResponse,
  createRouter, writable, ...) plus an injectable defaultPlugins that
  reads the real DesignSystem plugin and pinia store factory from a
  small registry instead of importing them. Depends on nothing in the
  cycle.
- web-pkg/src/testing: the mocks that need web-pkg's own types
  (defaultComponentMocks, createMockStore/PiniaMockOptions,
  useAppDefaultsMock, useGetMatchingSpaceMock) move here, published as
  a new "./src/testing" subpath so the facade can still reach them.
  web-pkg's own specs use this locally; nothing else needed to change.
- @ownclouders/web-test-helpers is now a thin facade: it registers the
  real DesignSystem plugin and pinia factory (import side effect) and
  re-exports web-test-helpers-core + web-pkg/src/testing under the
  exact same names. External consumers see zero difference.
- design-system's and web-pkg's own specs (only ones inside the former
  cycle) import straight from web-test-helpers-core / ../testing
  instead of the facade; every other package keeps importing
  @ownclouders/web-test-helpers unchanged.
- Shared vitest setup (tests/unit/config/vitest.init.ts) registers the
  same real plugin/factory for those two packages' own test runs,
  since they bypass the facade's registration.

Verified: pnpm install no longer warns about a workspace cycle;
vue-tsc, eslint and prettier all pass; all 16 vitest projects pass
individually (380 files / 3130 tests, 0 failures, matching pre-change
coverage exactly).
2026-09-21 17:45:42 +02:00
195 changed files with 1701 additions and 489 deletions

No files matched your search

+32 -2
View File
@@ -12,6 +12,7 @@ jobs:
timeout-minutes: 5
outputs:
web-changed: ${{ steps.check.outputs.web-changed }}
full-run: ${{ steps.check.outputs.full-run }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -23,16 +24,24 @@ jobs:
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
# full-run: push to master/stable-* or an explicit [full-ci] request always run
# everything, unscoped - same as before Nx. A normal PR gets the affected-scoped
# path instead (see web-build-test), since only those two cases actually need every
# project checked.
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "web-changed=true" >> "$GITHUB_OUTPUT"
echo "full-run=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if echo "$PR_TITLE" | grep -qi "\[full-ci\]"; then
echo "web-changed=true" >> "$GITHUB_OUTPUT"
echo "full-run=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "full-run=false" >> "$GITHUB_OUTPUT"
CHANGED_FILES=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" 2>/dev/null || git diff --name-only HEAD~1)
WEB_CHANGED=false
@@ -58,6 +67,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# nx affected --base=<pr-base-sha> (used below) needs that commit present locally
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
@@ -81,16 +93,34 @@ jobs:
run: pnpm licenses:csv && pnpm licenses:save
- name: Check types
# Whole-repo, unconditional: only 5/27 projects have a per-project typecheck target
# (nx/vite's typecheck inference needs a project's own vite.config.ts, which most
# web-app-* packages don't have - see docs/superpowers/specs), so `nx affected
# -t typecheck` can't safely stand in for this yet.
run: pnpm check:types
- name: Check format
run: pnpm check:format
- name: Lint
run: pnpm lint
env:
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
run: |
if [[ "$FULL_RUN" == "true" ]]; then
pnpm lint
else
pnpm exec nx affected -t lint --base="${{ github.event.pull_request.base.sha }}"
fi
- name: Run unit tests
run: pnpm test:unit --coverage
env:
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
run: |
if [[ "$FULL_RUN" == "true" ]]; then
pnpm test:unit --coverage
else
pnpm exec nx affected -t test --base="${{ github.event.pull_request.base.sha }}"
fi
- name: Build
run: pnpm build
+4
View File
@@ -41,6 +41,10 @@ playwright-report
/.pnpm-store/
# Nx local cache
.nx/cache
.nx/workspace-data
# drone CI is in .drone.star, do not let someone accidentally commit a local .drone.yml
.drone.yml
+49
View File
@@ -0,0 +1,49 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"defaultBase": "master",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [
"{workspaceRoot}/nx.json",
"{workspaceRoot}/pnpm-lock.yaml",
"{workspaceRoot}/pnpm-workspace.yaml",
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/eslint.config.js",
"{workspaceRoot}/vite.config.common.ts",
"{workspaceRoot}/vitest.config.ts",
"{workspaceRoot}/tests/unit/**/*"
]
},
"plugins": [
{
"plugin": "@nx/vitest",
"exclude": ["vite.config.ts", "vite.config.common.ts", "vite.cern.config.ts"],
"options": {
"testMode": "run"
}
},
"@nx/eslint/plugin",
{
"plugin": "@nx/vite/plugin",
"exclude": ["vite.config.ts", "vite.config.common.ts", "vite.cern.config.ts"],
"options": {
"buildTargetName": "nx-vite-build-unused",
"serveTargetName": "nx-vite-serve-unused",
"devTargetName": "nx-vite-dev-unused",
"previewTargetName": "nx-vite-preview-unused",
"serveStaticTargetName": "nx-vite-serve-static-unused",
"watchDepsTargetName": "nx-vite-watch-deps-unused",
"buildDepsTargetName": "nx-vite-build-deps-unused",
"typecheckTargetName": "typecheck"
}
}
],
"targetDefaults": {
"test": {
"cache": true,
"inputs": ["default", "^default"],
"outputs": []
}
},
"analytics": false
}
+5
View File
@@ -39,6 +39,9 @@
"@babel/preset-env": "7.28.5",
"@babel/register": "7.28.3",
"@noble/hashes": "2.0.1",
"@nx/eslint": "23.2.1",
"@nx/vite": "23.2.1",
"@nx/vitest": "23.2.1",
"@ownclouders/babel-preset": "workspace:*",
"@ownclouders/eslint-config": "workspace:*",
"@ownclouders/prettier-config": "workspace:*",
@@ -69,6 +72,7 @@
"jsqr": "^1.4.0",
"license-checker-rseidelsohn": "4.4.2",
"node-fetch": "3.3.2",
"nx": "^23.2.1",
"pino": "10.1.0",
"pino-pretty": "13.1.2",
"prettier": "^3.6.2",
@@ -102,6 +106,7 @@
},
"pnpm": {
"overrides": {
"typescript": "5.9.3",
"nanoid": "^3.3.17",
"elliptic": "6.6.1",
"sha.js": "2.4.12",
+15 -2
View File
@@ -22,7 +22,6 @@
"main": "src/index.ts",
"private": false,
"scripts": {
"lint": "lint:stylelint",
"lint:stylelint": "stylelint './src/styles/**/*.scss' --cache",
"tokens": "node build/build-tokens.js",
"tokens:w": "onchange -i \"./src/tokens/**/*.json\" -- npm run tokens",
@@ -66,6 +65,11 @@
"default": "./dist/design-system/helpers.js",
"require": "./dist/design-system/helpers.cjs",
"types": "./dist/types/helpers/index.d.ts"
},
"./testing": {
"default": "./dist/design-system/testing.js",
"require": "./dist/design-system/testing.cjs",
"types": "./dist/types/testing/index.d.ts"
}
}
},
@@ -84,6 +88,9 @@
},
"./l10n": {
"default": "./l10n/translations.json"
},
"./testing": {
"default": "./src/testing/index.ts"
}
},
"dependencies": {
@@ -108,8 +115,8 @@
"@babel/plugin-transform-runtime": "7.28.5",
"@babel/preset-env": "7.28.5",
"@babel/runtime": "7.28.4",
"@ownclouders/web-test-helpers": "workspace:*",
"@vitejs/plugin-vue": "6.0.1",
"@vue/test-utils": "2.4.6",
"autoprefixer": "10.4.22",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "^10.0.0",
@@ -141,6 +148,12 @@
"yaml": "^2.8.1"
},
"peerDependencies": {
"@vue/test-utils": "^2.4.6",
"vue": "^3.5.29"
},
"peerDependenciesMeta": {
"@vue/test-utils": {
"optional": true
}
}
}
@@ -1,6 +1,6 @@
import { PartialComponentProps, mount } from '@ownclouders/web-test-helpers'
import OcAvatar from './OcAvatar.vue'
import { extractInitials } from './extractInitials'
import { PartialComponentProps, mount } from '../../testing'
describe('extractInitials', () => {
describe('should allow alphanumeric characters', () => {
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Count from './OcAvatarCount.vue'
import { shallowMount } from '../../testing'
describe('OcAvatarCount', () => {
it('dynamically calculates font size', () => {
@@ -1,5 +1,5 @@
import OcAvatarItem from './OcAvatarItem.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
describe('OcAvatarItem', () => {
function getWrapperWithProps(props = {}) {
return mount(OcAvatarItem, {
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Avatars from './OcAvatars.vue'
import { shallowMount } from '../../testing'
const items = [
{
@@ -1,5 +1,5 @@
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import Breadcrumb from './OcBreadcrumb.vue'
import { defaultPlugins, shallowMount } from '../../testing'
const items = [
{ text: 'First folder', to: { path: 'folder' } },
@@ -1,5 +1,5 @@
import { PartialComponentProps, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import OcButton from './OcButton.vue'
import { PartialComponentProps, defaultPlugins, shallowMount } from '../../testing'
describe('OcButton', () => {
it('should display slot html', () => {
@@ -1,6 +1,5 @@
import OcCheckbox from './OcCheckbox.vue'
import { PartialComponentProps, mount } from '@ownclouders/web-test-helpers'
import { PartialComponentProps, mount } from '../../testing'
describe('OcCheckbox', () => {
function getWrapperWithProps(props: PartialComponentProps<typeof OcCheckbox>) {
return mount(OcCheckbox, {
@@ -1,7 +1,7 @@
import Datepicker from './OcDatepicker.vue'
import { ComponentProps, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { DateTime } from 'luxon'
import { nextTick } from 'vue'
import { ComponentProps, defaultPlugins, shallowMount } from '../../testing'
describe('OcDatePicker', () => {
it('renders', () => {
@@ -1,6 +1,6 @@
import { shallowMount, mount } from '@ownclouders/web-test-helpers'
import Drop from './OcDrop.vue'
import { getSizeClass } from '../../helpers'
import { shallowMount, mount } from '../../testing'
const dom = ({ position = 'auto', mode = 'click', paddingSize = 'medium' } = {}) => {
document.body.innerHTML = ''
@@ -1,6 +1,5 @@
import OcDropzone from './OcDropzone.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
describe('OcDropzone', () => {
const selectors = {
dropzone: '.oc-dropzone'
@@ -1,5 +1,5 @@
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import OcFilterChip from './OcFilterChip.vue'
import { defaultPlugins, mount } from '../../testing'
const selectors = {
filterChipBtn: '.oc-filter-chip-button',
@@ -1,6 +1,5 @@
import OcGrid from './OcGrid.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
describe('OcGrid', () => {
function getWrapper(props = {}) {
return mount(OcGrid, {
@@ -1,6 +1,5 @@
import OcHiddenAnnouncer from './OcHiddenAnnouncer.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
describe('OcHiddenAnnouncer', () => {
function getWrapper(props = {}) {
return mount(OcHiddenAnnouncer, {
@@ -1,7 +1,7 @@
import { mount } from '@ownclouders/web-test-helpers'
import OcIcon from './OcIcon.vue'
import { glob } from 'glob'
import path from 'path'
import { mount } from '../../testing'
describe('OcIcon', () => {
test('render and update', async () => {
@@ -1,6 +1,5 @@
import OcImage from './OcImage.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
// @vitest-environment jsdom
describe('OcImage', () => {
function getWrapper(props = {}) {
@@ -1,8 +1,7 @@
import { FocusTrap } from 'focus-trap-vue'
import OcDrop from '../OcDrop/OcDrop.vue'
import OcInfoDrop from './OcInfoDrop.vue'
import { PartialComponentProps, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { PartialComponentProps, defaultPlugins, shallowMount } from '../../testing'
describe('OcInfoDrop', () => {
function getWrapperWithProps(props: PartialComponentProps<typeof OcInfoDrop>) {
return shallowMount(OcInfoDrop, {
@@ -1,6 +1,5 @@
import OcLoader from './OcLoader.vue'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
const selectors = {
label: '[data-testid="oc-loader-label"]'
}
@@ -1,6 +1,6 @@
import OcLogo from './OcLogo.vue'
import { shallowMount, mount } from '@ownclouders/web-test-helpers'
import OcImage from '../OcImage/OcImage.vue'
import { shallowMount, mount } from '../../testing'
describe('OcLogo', () => {
const requiredProps = {
@@ -1,7 +1,7 @@
import { defaultPlugins, mount, shallowMount } from '@ownclouders/web-test-helpers'
import { FocusTrap } from 'focus-trap-vue'
import Modal from './OcModal.vue'
import OcButton from './../OcButton/OcButton.vue'
import { defaultPlugins, mount, shallowMount } from '../../testing'
const defaultProps = {
title: 'Example title',
@@ -1,6 +1,5 @@
import OcNotificationMessage from './OcNotificationMessage.vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../testing'
describe('OcNotificationMessage', () => {
beforeEach(() => {
vi.useFakeTimers()
@@ -1,6 +1,5 @@
import OcNotifications from './OcNotifications.vue'
import { shallowMount } from '@ownclouders/web-test-helpers'
import { shallowMount } from '../../testing'
describe('OcNotifications', () => {
function getWrapper(options = {}) {
return shallowMount(OcNotifications, options)
@@ -1,6 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import PageSize from './OcPageSize.vue'
import { shallowMount } from '../../testing'
const defaultProps = {
options: [100, 500, 1000, 'All'],
@@ -1,7 +1,7 @@
import { defaultPlugins, shallowMount, RouteLocation } from '@ownclouders/web-test-helpers'
import { mock } from 'vitest-mock-extended'
import { RouteLocationPathRaw, RouterLink } from 'vue-router'
import Pagination from './OcPagination.vue'
import { defaultPlugins, shallowMount, RouteLocation } from '../../testing'
const defaultProps = {
pages: 5,
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Progress from './OcProgress.vue'
import { shallowMount } from '../../testing'
describe('OcProgress', () => {
it('sets correct classes', () => {
@@ -1,6 +1,6 @@
import OcRadio from './OcRadio.vue'
import { PartialComponentProps, mount } from '@ownclouders/web-test-helpers'
import { AvailableSizeType } from '../../helpers'
import { PartialComponentProps, mount } from '../../testing'
describe('OcRadio', () => {
function getWrapper(props: PartialComponentProps<typeof OcRadio> = {}) {
@@ -1,6 +1,6 @@
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import Recipient from './OcRecipient.vue'
import { Recipient as RecipientType } from '../../helpers'
import { defaultPlugins, shallowMount } from '../../testing'
describe('OcRecipient', () => {
function getWrapper(props: Partial<RecipientType> = undefined, slot: string = undefined) {
@@ -1,5 +1,5 @@
import { defaultPlugins, mount, shallowMount } from '@ownclouders/web-test-helpers'
import OcSearchBar from './OcSearchBar.vue'
import { defaultPlugins, mount, shallowMount } from '../../testing'
describe('OcSearchBar', () => {
const selectors = {
@@ -1,5 +1,5 @@
import { defaultPlugins, mount, PartialComponentProps } from '@ownclouders/web-test-helpers'
import OcSelect from './OcSelect.vue'
import { defaultPlugins, mount, PartialComponentProps } from '../../testing'
const selectors = {
ocSelect: '.oc-select',
@@ -1,6 +1,5 @@
import StatusIndicators from './OcStatusIndicators.vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../testing'
const fileResource = {
name: 'forest.jpg',
path: 'nature/forest.jpg',
@@ -1,6 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Switch from './OcSwitch.vue'
import { shallowMount } from '../../testing'
const defaultProps = {
label: 'Test label'
@@ -1,5 +1,5 @@
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import Table from './OcTable.vue'
import { defaultPlugins, mount } from '../../testing'
const ASC = 'ascending'
const DESC = 'descending'
@@ -1,5 +1,5 @@
import { shallowMount, mount, defaultPlugins } from '@ownclouders/web-test-helpers'
import Table from './OcTable.vue'
import { shallowMount, mount, defaultPlugins } from '../../testing'
const fields = [
{
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Cell from './OcTableCell.vue'
import { shallowMount } from '../../testing'
describe('OcTableCell', () => {
it('Uses correct element', () => {
@@ -1,6 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Table from './OcTableSimple.vue'
import { shallowMount } from '../../testing'
describe('OcTableSimple', () => {
it('adds hover', () => {
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Tag from './OcTag.vue'
import { shallowMount } from '../../testing'
describe('OcTag', () => {
it('uses correct component when type is specified', () => {
@@ -1,7 +1,7 @@
import { shallowMount, mount, defaultPlugins } from '@ownclouders/web-test-helpers'
import OcTextInput from './OcTextInput.vue'
import { PasswordPolicy } from '../../helpers'
import { mock } from 'vitest-mock-extended'
import { shallowMount, mount, defaultPlugins } from '../../testing'
interface Props {
id?: string
@@ -1,5 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import OcTextarea from './OcTextarea.vue'
import { shallowMount } from '../../testing'
const defaultProps = {
label: 'label'
@@ -1,7 +1,6 @@
import { ref, nextTick } from 'vue'
import { useIsVisible } from './index'
import { mount } from '@ownclouders/web-test-helpers'
import { mount } from '../../testing'
const mockIntersectionObserver = () => {
const enable = () => {
const mock = {
+5 -1
View File
@@ -12,7 +12,11 @@ const initializeCustomProps = (tokens: string[] = [], prefix: string) => {
export default {
install(app: App, options: any = {}) {
import('./utils/webFontLoader')
// Fire-and-forget, so nothing awaits the rejection: webfonts are cosmetic, and failing to
// load them must not surface as an unhandled rejection. Under vitest this import can still
// be in flight when the test environment is torn down, which rejects with
// `EnvironmentTeardownError`.
import('./utils/webFontLoader').catch(() => {})
const themeOptions = options.tokens
initializeCustomProps(themeOptions?.breakpoints, 'breakpoint-')
@@ -0,0 +1,86 @@
import { App, Plugin, h } from 'vue'
import { createGettext } from 'vue3-gettext'
import DesignSystem from '../index'
/**
* Test helpers for mounting components that render design system components (`<oc-button>`,
* `<oc-icon>`, ...). Those are registered globally by this package's Vue plugin, so anything
* that mounts them has to install it first.
*
* They live here rather than in a dedicated test-helper package because `design-system` sits at
* the bottom of the workspace package graph: it cannot depend on a package that installs it
* without forming a cycle - which is exactly what {design-system, web-pkg, web-test-helpers}
* used to be.
*
* `@ownclouders/web-pkg/src/testing` builds on this and adds what its own components need
* (pinia stores, casl abilities); `@ownclouders/web-test-helpers` re-exports that in turn.
* Only `design-system`'s own specs should import from here - everything else uses
* `@ownclouders/web-test-helpers`.
*/
export { mount, shallowMount, flushPromises, VueWrapper, RouterLinkStub } from '@vue/test-utils'
export type { RouteLocation } from 'vue-router'
type DefinedComponent = new (...args: any[]) => any
export type ComponentProps<T extends DefinedComponent> = InstanceType<T>['$props']
export type PartialComponentProps<T extends DefinedComponent> = Partial<ComponentProps<T>>
export interface DesignSystemPluginsOptions {
designSystem?: boolean
gettext?: boolean
getTextDefaultLanguage?: string
}
/**
* Stubs `<router-link>` so components can render links without a real router instance.
*/
export const routerLinkStubPlugin: Plugin = {
install(app: App) {
app.component('RouterLink', {
name: 'RouterLink',
props: {
tag: { type: String, default: 'a' },
to: { type: [String, Object], default: '' }
},
setup(props) {
let path = props.to
if (!!path && typeof path !== 'string') {
path = props.to.path || props.to.name
if (props.to.params) {
path += '/' + Object.values(props.to.params).join('/')
}
if (props.to.query) {
path += '?' + Object.values(props.to.query).join('&')
}
}
return () => h(props.tag, { attrs: { href: path } })
}
})
}
}
export const defaultPlugins = ({
designSystem = true,
gettext = true,
getTextDefaultLanguage = 'en'
}: DesignSystemPluginsOptions = {}): Plugin[] => {
const plugins: Plugin[] = []
if (designSystem) {
plugins.push(DesignSystem as unknown as Plugin)
}
if (gettext) {
plugins.push(
createGettext({ translations: {}, silent: true, defaultLanguage: getTextDefaultLanguage })
)
}
plugins.push(routerLinkStubPlugin)
return plugins
}
+2 -1
View File
@@ -30,7 +30,8 @@ export default defineConfig({
'design-system': resolve(__dirname, 'src/index.ts'),
'design-system/components': resolve(__dirname, 'src/components/index.ts'),
'design-system/composables': resolve(__dirname, 'src/composables/index.ts'),
'design-system/helpers': resolve(__dirname, 'src/helpers/index.ts')
'design-system/helpers': resolve(__dirname, 'src/helpers/index.ts'),
'design-system/testing': resolve(__dirname, 'src/testing/index.ts')
}
},
rollupOptions: {
@@ -30,7 +30,8 @@ describe('Resource Upload Component', () => {
it('should call "triggerUpload"', async () => {
const { wrapper } = getWrapper()
const spyTriggerUpload = vi.spyOn(wrapper.vm, 'triggerUpload')
// triggerUpload is a <script setup> binding, not part of the public instance type
const spyTriggerUpload = vi.spyOn(wrapper.vm as any, 'triggerUpload')
const uploadButton = wrapper.find('button')
const fileUploadInput = wrapper.find('#files-file-upload-input')
+7 -1
View File
@@ -25,6 +25,11 @@
"import": "./dist/web-pkg.js",
"require": "./dist/web-pkg.umd.cjs",
"types": "./dist/types/index.d.ts"
},
"./src/testing": {
"import": "./dist/web-pkg-testing.js",
"require": "./dist/web-pkg-testing.umd.cjs",
"types": "./dist/types/testing/index.d.ts"
}
}
},
@@ -42,6 +47,7 @@
"@ownclouders/design-system": "workspace:^",
"@ownclouders/web-client": "workspace:^",
"@pdf-lib/fontkit": "^1.1.1",
"@pinia/testing": "^1.0.3",
"@sentry/vue": "10.51.0",
"@uppy/core": "5.2.0",
"@uppy/drop-target": "4.1.0",
@@ -76,13 +82,13 @@
"qs": "^6.15.2",
"screenfull": "^6.0.2",
"uuid": "^14.0.0",
"vitest-mock-extended": "3.1.1",
"vue-concurrency": "^5.0.3",
"vue-router": "^5.0.6",
"vue3-gettext": "^4.0.1",
"zod": "^4.3.6"
},
"devDependencies": {
"@ownclouders/web-test-helpers": "workspace:^",
"@types/lodash-es": "4.17.12",
"@vitest/web-worker": "4.1.5",
"clean-publish": "6.0.1",
@@ -6,11 +6,10 @@ import {
PasswordPolicyService,
PreviewService,
UppyService
} from '@ownclouders/web-pkg'
} from '../index'
import { Router, RouteLocationNormalizedLoaded, RouteLocationRaw } from 'vue-router'
import { computed } from 'vue'
import { writable } from '../helpers'
import { writable } from '.'
export interface ComponentMocksOptions {
currentRoute?: RouteLocationNormalizedLoaded
}
@@ -0,0 +1,34 @@
import { App, Plugin } from 'vue'
import { abilitiesPlugin } from '@casl/vue'
import { createMongoAbility } from '@casl/ability'
import { AbilityRule } from '@ownclouders/web-client'
import {
defaultPlugins as designSystemPlugins,
DesignSystemPluginsOptions
} from '@ownclouders/design-system/testing'
import { createMockStore, PiniaMockOptions } from './pinia'
// Extends the design system's mount plugins (design system itself + gettext + a `<router-link>`
// stub) with what web-pkg's own components need on top: casl abilities and mocked pinia stores.
// The design system half is defined once, in `@ownclouders/design-system/testing`, because that
// package needs it for its own specs and cannot depend on this one.
export interface DefaultPluginsOptions extends DesignSystemPluginsOptions {
abilities?: AbilityRule[]
pinia?: boolean
piniaOptions?: PiniaMockOptions
}
export const defaultPlugins = ({
abilities = [],
pinia = true,
piniaOptions = {},
...designSystemOptions
}: DefaultPluginsOptions = {}): Plugin[] => [
{
install(app: App) {
app.use(abilitiesPlugin, createMongoAbility(abilities))
}
},
...designSystemPlugins(designSystemOptions),
...(pinia ? [createMockStore(piniaOptions)] : [])
]
@@ -1,10 +1,25 @@
import { mount, VueWrapper } from '@vue/test-utils'
import { defineComponent, nextTick } from 'vue'
import { createRouter as _createRouter, createMemoryHistory, RouterOptions } from 'vue-router'
import {
mount,
shallowMount,
flushPromises,
VueWrapper,
RouterLinkStub,
routerLinkStubPlugin
} from '@ownclouders/design-system/testing'
import type {
RouteLocation,
ComponentProps,
PartialComponentProps
} from '@ownclouders/design-system/testing'
import { defaultPlugins, DefaultPluginsOptions } from './defaultPlugins'
export { mount, shallowMount, flushPromises, VueWrapper } from '@vue/test-utils'
vi.spyOn(console, 'warn').mockImplementation(() => undefined)
// Generic mount helpers and prop types live in `@ownclouders/design-system/testing`, since that
// package sits below this one and cannot import from it. Re-exported here so consumers get the
// full set from a single entrypoint.
export { mount, shallowMount, flushPromises, VueWrapper, RouterLinkStub, routerLinkStubPlugin }
export type { RouteLocation, ComponentProps, PartialComponentProps }
export const getComposableWrapper = <T>(
setup: (...args: any[]) => T,
@@ -53,8 +68,6 @@ export const getOcSelectOptions = async (
return optionElements
}
export type { RouteLocation } from 'vue-router'
export { RouterLinkStub } from '@vue/test-utils'
export const createRouter = (options?: Partial<RouterOptions>) =>
_createRouter({
history: createMemoryHistory(),
@@ -76,7 +89,3 @@ export const nextTicks = async (amount: number) => {
await nextTick()
}
}
type DefinedComponent = new (...args: any[]) => any
export type ComponentProps<T extends DefinedComponent> = InstanceType<T>['$props']
export type PartialComponentProps<T extends DefinedComponent> = Partial<ComponentProps<T>>
@@ -1,5 +1,7 @@
export * from './defaultComponentMocks'
export * from './defaultPlugins'
export * from './defaultStubs'
export * from './helpers'
export * from './httpResponse'
export * from './pinia'
export * from './useAppDefaultsMock'
@@ -10,7 +10,7 @@ import {
Modal,
OptionsConfig,
WebThemeType
} from '@ownclouders/web-pkg'
} from '../index'
import {
CollaboratorShare,
LinkShare,
@@ -1,6 +1,6 @@
import { mock } from 'vitest-mock-extended'
import { ref } from 'vue'
import { FileContext, useAppDefaults, AppConfigObject } from '@ownclouders/web-pkg'
import { FileContext, useAppDefaults, AppConfigObject } from '../index'
import { FileResource, Resource } from '@ownclouders/web-client'
import { GetFileContentsResponse } from '@ownclouders/web-client/webdav'
@@ -1,5 +1,5 @@
import { mock } from 'vitest-mock-extended'
import { useGetMatchingSpace } from '@ownclouders/web-pkg'
import { useGetMatchingSpace } from '../index'
import { SpaceResource } from '@ownclouders/web-client'
export const useGetMatchingSpaceMock = (
@@ -1,4 +1,4 @@
import { defaultComponentMocks, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '../../../src/testing'
import AppBanner from '../../../src/components/AppBanner.vue'
import { createMemoryHistory, createRouter } from 'vue-router'
import { useLocalStorage, useSessionStorage } from '@vueuse/core'
@@ -5,10 +5,10 @@ import { Resource, SpaceResource } from '@ownclouders/web-client'
import {
defaultComponentMocks,
defaultPlugins,
shallowMount,
PartialComponentProps,
RouteLocation,
PartialComponentProps
} from '@ownclouders/web-test-helpers'
shallowMount
} from '../../../../src/testing'
import { ArchiverService } from '../../../../src/services'
import { FolderView } from '../../../../src/ui/types'
import { useExtensionRegistry, ViewOptions } from '../../../../src'
@@ -1,7 +1,7 @@
import CreateSpace from '../../../../src/components/AppBar/CreateSpace.vue'
import { mockDeep } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { defaultPlugins, mount, defaultComponentMocks } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../../src/testing'
import { useMessages, useModals, useSpacesStore } from '../../../../src/composables'
import { unref } from 'vue'
@@ -1,6 +1,5 @@
import ErrorScreen from '../../../../src/components/AppTemplates/PartialViews/ErrorScreen.vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../../../src/testing'
describe('The external app error screen component', () => {
test('displays an icon and a paragraph', () => {
const wrapper = mount(ErrorScreen, {
@@ -1,6 +1,5 @@
import LoadingScreen from '../../../../src/components/AppTemplates/PartialViews/LoadingScreen.vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../../../src/testing'
describe('The external app loading screen component', () => {
test('displays a spinner and a paragraph', () => {
const wrapper = mount(LoadingScreen, {
@@ -1,11 +1,11 @@
import { mock } from 'vitest-mock-extended'
import {
RouteLocation,
defaultComponentMocks,
defaultPlugins,
RouteLocation,
shallowMount,
useGetMatchingSpaceMock
} from '@ownclouders/web-test-helpers'
} from '../../../src/testing'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import AppTopBar from '../../../src/components/AppTopBar.vue'
import { Action } from '../../../src/composables/actions'
@@ -1,4 +1,4 @@
import { PartialComponentProps, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount, PartialComponentProps } from '../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { Resource } from '@ownclouders/web-client'
import BatchActions from '../../../src/components/BatchActions.vue'
@@ -1,7 +1,6 @@
import ActionMenuItem from '../../../../src/components/ContextActions/ActionMenuItem.vue'
import { FileAction } from '../../../../src/composables/actions'
import { defaultPlugins, mount, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount, shallowMount } from '../../../../src/testing'
const selectors = {
handler: '[data-testid="action-handler"]',
icon: '[data-testid="action-icon"]',
@@ -1,7 +1,6 @@
import ContextActionMenu from '../../../../src/components/ContextActions/ContextActionMenu.vue'
import { Action } from '../../../../src/composables/actions'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../../src/testing'
describe('ContextActionMenu component', () => {
it('renders the menu with actions', () => {
const menuSections = [
@@ -1,6 +1,5 @@
import ContextMenuQuickAction from '../../../../src/components/ContextActions/ContextMenuQuickAction.vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../../../src/testing'
describe('ContextMenuQuickAction component', () => {
it('renders component', () => {
const { wrapper } = getWrapper()
@@ -1,10 +1,5 @@
import CreateLinkModal from '../../../src/components/CreateLinkModal.vue'
import {
ComponentProps,
defaultComponentMocks,
defaultPlugins,
mount
} from '@ownclouders/web-test-helpers'
import { ComponentProps, defaultComponentMocks, defaultPlugins, mount } from '../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { PasswordPolicyService } from '../../../src/services'
import { usePasswordPolicyService } from '../../../src/composables/passwordPolicyService'
@@ -5,7 +5,7 @@ import {
mockHttpError,
RouteLocation,
shallowMount
} from '@ownclouders/web-test-helpers'
} from '../../../src/testing'
import { SpaceResource } from '@ownclouders/web-client'
import { mock } from 'vitest-mock-extended'
import { FileResource } from '@ownclouders/web-client'
@@ -1,5 +1,5 @@
import CustomComponentTarget from '../../../src/components/CustomComponentTarget.vue'
import { defaultComponentMocks, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../src/testing'
import {
CustomComponentExtension,
Extension,
@@ -1,9 +1,4 @@
import {
defaultComponentMocks,
defaultPlugins,
defaultStubs,
mount
} from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, defaultStubs, mount } from '../../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import ContextActions from '../../../../src/components/FilesList/ContextActions.vue'
@@ -1,4 +1,3 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import { AVAILABLE_SIZES } from '@ownclouders/design-system/helpers'
import ResourceIcon from '../../../../src/components/FilesList/ResourceIcon.vue'
import {
@@ -6,6 +5,7 @@ import {
resourceIconMappingInjectionKey
} from '../../../../src/helpers/resource'
import { Resource } from '@ownclouders/web-client'
import { shallowMount } from '../../../../src/testing'
const resourceIconMapping: ResourceIconMapping = {
extension: {
@@ -1,4 +1,4 @@
import { defaultComponentMocks, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../../src/testing'
import ResourceListItem from '../../../../src/components/FilesList/ResourceListItem.vue'
import { HIDDEN_FILE_EXTENSIONS, Resource } from '@ownclouders/web-client'
import { mock } from 'vitest-mock-extended'
@@ -1,6 +1,5 @@
import { shallowMount } from '@ownclouders/web-test-helpers'
import Name from '../../../../src/components/FilesList/ResourceName.vue'
import { shallowMount } from '../../../../src/testing'
const fullPath = 'images/nature/forest.jpg'
const name = 'forest.jpg'
@@ -1,4 +1,4 @@
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../../src/testing'
import ResourceStatusIndicators from '../../../../src/components/FilesList/ResourceStatusIndicators.vue'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { mock } from 'vitest-mock-extended'
@@ -8,7 +8,7 @@ import {
ShareTypes,
SpaceResource
} from '@ownclouders/web-client'
import { defaultPlugins, mount, PartialComponentProps } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount, PartialComponentProps } from '../../../../src/testing'
import {
CapabilityStore,
useResourcesStore,
@@ -1,4 +1,4 @@
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../../src/testing'
import { RouteLocationRaw } from 'vue-router'
import { SpaceResource, Resource } from '@ownclouders/web-client'
import ResourceTile from '../../../../src/components/FilesList/ResourceTile.vue'
@@ -1,4 +1,4 @@
import { defaultComponentMocks, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../../src/testing'
import ResourceTiles from '../../../../src/components/FilesList/ResourceTiles.vue'
import { sortFields } from '../../../../src/helpers/ui/resourceTiles'
import { Resource, SpaceResource } from '@ownclouders/web-client'
@@ -1,10 +1,10 @@
import DateFilter from '../../../../src/components/Filters/DateFilter.vue'
import {
PartialComponentProps,
defaultComponentMocks,
defaultPlugins,
mount
} from '@ownclouders/web-test-helpers'
mount,
PartialComponentProps
} from '../../../../src/testing'
import { queryItemAsString } from '../../../../src/composables/appDefaults'
import { DateTime } from 'luxon'
@@ -5,7 +5,7 @@ import {
defaultPlugins,
mount,
PartialComponentProps
} from '@ownclouders/web-test-helpers'
} from '../../../../src/testing'
import { queryItemAsString } from '../../../../src/composables/appDefaults'
import { mock } from 'vitest-mock-extended'
@@ -1,10 +1,10 @@
import ItemFilter from '../../../src/components/ItemFilter.vue'
import {
PartialComponentProps,
defaultComponentMocks,
defaultPlugins,
mount
} from '@ownclouders/web-test-helpers'
mount,
PartialComponentProps
} from '../../../src/testing'
import { queryItemAsString } from '../../../src/composables/appDefaults'
import { OcCheckbox } from '@ownclouders/design-system/components'
@@ -1,5 +1,5 @@
import ItemFilterToggle from '../../../src/components/ItemFilterToggle.vue'
import { defaultComponentMocks, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../src/testing'
import { queryItemAsString } from '../../../src/composables/appDefaults'
vi.mock('../../../src/composables/appDefaults', () => ({
@@ -1,5 +1,5 @@
import LinkRoleDropdown from '../../../src/components/LinkRoleDropdown.vue'
import { defaultComponentMocks, defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, mount } from '../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { ShareRole } from '@ownclouders/web-client'
import { SharingLinkType } from '@ownclouders/web-client/graph/generated'
@@ -1,5 +1,5 @@
import LoadingIndicator from '../../../src/components/LoadingIndicator.vue'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { LoadingService } from '../../../src/services'
import { OcProgress } from '@ownclouders/design-system/components'
@@ -1,5 +1,5 @@
import ExportAsPdfModal from '../../../../src/components/Modals/ExportAsPdfModal.vue'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '../../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { Modal, useMessages, useModals } from '../../../../src/composables/piniaStores'
@@ -1,5 +1,5 @@
import FilePickerModal from '../../../../src/components/Modals/FilePickerModal.vue'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '../../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { Modal, useModals } from '../../../../src/composables/piniaStores'
@@ -1,5 +1,5 @@
import ResourceConflictModal from '../../../../src/components/Modals/ResourceConflictModal.vue'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '../../../../src/testing'
import { mock } from 'vitest-mock-extended'
import { Resource } from '@ownclouders/web-client'
import { ResolveStrategy } from '../../../../src/helpers/resource'
@@ -4,7 +4,7 @@ import {
defaultPlugins,
nextTicks,
shallowMount
} from '@ownclouders/web-test-helpers'
} from '../../../../src/testing'
import { mock, mockDeep } from 'vitest-mock-extended'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { ListFilesResult } from '@ownclouders/web-client/webdav'
@@ -1,6 +1,5 @@
import NoContentMessage from '../../../src/components/NoContentMessage.vue'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../src/testing'
describe('NoContentMessage', () => {
describe('icon prop', () => {
it('should render the provided icon', () => {
@@ -1,13 +1,13 @@
import { mock } from 'vitest-mock-extended'
import merge from 'lodash-es/merge'
import {
defaultComponentMocks,
defaultPlugins,
mount,
shallowMount,
RouteLocation,
RouterLinkStub,
defaultComponentMocks,
RouteLocation
} from '@ownclouders/web-test-helpers'
shallowMount
} from '../../../src/testing'
import Pagination from '../../../src/components/Pagination.vue'
const filesPersonalRoute = { name: 'files-personal', path: '/files/home' }
@@ -1,6 +1,5 @@
import QuotaSelect from '../../../src/components/QuotaSelect.vue'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../src/testing'
describe('QuotaSelect', () => {
describe('method "optionSelectable"', () => {
it('should return true while option selectable property is not false', () => {
@@ -7,7 +7,7 @@ import {
defaultPlugins,
mount,
useGetMatchingSpaceMock
} from '@ownclouders/web-test-helpers'
} from '../../../../src/testing'
import { useFileActions } from '../../../../src/composables/actions'
import { CapabilityStore } from '../../../../src/composables/piniaStores'
import ResourceListItem from '../../../../src/components/FilesList/ResourceListItem.vue'
@@ -1,6 +1,6 @@
import { useRouteQuery } from '../../../src/composables/router/useRouteQuery'
import SearchBarFilter from '../../../src/components/SearchBarFilter.vue'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, shallowMount } from '../../../src/testing'
import { OcFilterChip } from '@ownclouders/design-system/components'
import { ref } from 'vue'
@@ -1,6 +1,6 @@
import { OcProgress } from '@ownclouders/design-system/components'
import { SpaceQuota } from '../../../src/components'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../src/testing'
import { Quota } from '@ownclouders/web-client/graph/generated'
describe('SpaceQuota component', () => {
@@ -1,10 +1,5 @@
import QuotaModal from '../../../../src/components/Spaces/QuotaModal.vue'
import {
defaultComponentMocks,
defaultPlugins,
defaultStubs,
mount
} from '@ownclouders/web-test-helpers'
import { defaultComponentMocks, defaultPlugins, defaultStubs, mount } from '../../../../src/testing'
import { useMessages, useSpacesStore } from '../../../../src/composables/piniaStores'
import { SpaceResource } from '@ownclouders/web-client'
import { mock } from 'vitest-mock-extended'
@@ -1,5 +1,5 @@
import { defineComponent, nextTick } from 'vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../../../src/testing'
import { flushPromises } from '@vue/test-utils'
import { config } from 'md-editor-v3'
import { useMessages } from '../../../../src/composables'
@@ -1,6 +1,6 @@
import { flushPromises } from '@vue/test-utils'
import { nextTick } from 'vue'
import { defaultPlugins, mount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, mount } from '../../../../src/testing'
import TextEditor from '../../../../src/components/TextEditor/TextEditor.vue'
// Mounts the real md-editor-v3 rather than the stub used by TextEditor.spec.ts: the `footers`
@@ -1,11 +1,11 @@
import { ref, unref } from 'vue'
import {
defaultPlugins,
defaultComponentMocks,
defaultPlugins,
mount,
RouteLocation,
PartialComponentProps
} from '@ownclouders/web-test-helpers'
PartialComponentProps,
RouteLocation
} from '../../../src/testing'
import { mock } from 'vitest-mock-extended'
import ViewOptions from '../../../src/components/ViewOptions.vue'
import {
@@ -1,6 +1,5 @@
import CompareSaveDialog from '../../../../src/components/SideBar/CompareSaveDialog.vue'
import { defaultPlugins, shallowMount } from '@ownclouders/web-test-helpers'
import { defaultPlugins, shallowMount } from '../../../../src/testing'
describe('CompareSaveDialog', () => {
describe('computed method "unsavedChanges"', () => {
it('should be false if objects are equal', () => {
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff. Show more