@testing-library/vue
Advanced tools
Comparing version 8.0.3 to 8.1.0
@@ -15,6 +15,6 @@ "use strict"; | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } | ||
var mountedWrappers = new Set(); | ||
@@ -21,0 +21,0 @@ function render(Component) { |
{ | ||
"name": "@testing-library/vue", | ||
"version": "8.0.3", | ||
"version": "8.1.0", | ||
"description": "Simple and complete Vue DOM testing utilities that encourage good testing practices.", | ||
@@ -71,5 +71,7 @@ "main": "dist/index.js", | ||
"tsd": "^0.29.0", | ||
"type-fest": "~2.19", | ||
"typescript": "^5.2.2", | ||
"vee-validate": "^4.11.8", | ||
"vue": "^3.3.5", | ||
"vue-component-type-helpers": "^2.0.19", | ||
"vue-eslint-parser": "^9.3.2", | ||
@@ -76,0 +78,0 @@ "vue-i18n": "^9.5.0", |
// Minimum TypeScript Version: 4.0 | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import {VNodeChild} from 'vue' | ||
import {MountingOptions} from '@vue/test-utils' | ||
@@ -8,2 +9,4 @@ import {queries, EventType, BoundFunctions} from '@testing-library/dom' | ||
import {OptionsReceived as PrettyFormatOptions} from 'pretty-format' | ||
import {ComponentProps, ComponentSlots} from 'vue-component-type-helpers' | ||
import {RemoveIndexSignature} from 'type-fest' | ||
@@ -48,8 +51,22 @@ // NOTE: fireEvent is overridden below | ||
} | ||
export type RenderOptions = VueTestingLibraryRenderOptions & | ||
VueTestUtilsRenderOptions | ||
export function render( | ||
TestComponent: any, // this makes me sad :sob: | ||
options?: RenderOptions, | ||
type AllowNonFunctionSlots<Slots> = { | ||
[K in keyof Slots]: Slots[K] | VNodeChild | ||
} | ||
type ExtractSlots<C> = AllowNonFunctionSlots< | ||
Partial<RemoveIndexSignature<ComponentSlots<C>>> | ||
> | ||
export interface RenderOptions<C> | ||
extends Omit< | ||
VueTestingLibraryRenderOptions & VueTestUtilsRenderOptions, | ||
'props' | 'slots' | ||
> { | ||
props?: ComponentProps<C> | ||
slots?: ExtractSlots<C> | ||
} | ||
export function render<C>( | ||
TestComponent: C, | ||
options?: RenderOptions<C>, | ||
): RenderResult | ||
@@ -56,0 +73,0 @@ |
@@ -71,3 +71,3 @@ import {expectType} from 'tsd' | ||
attrs: {a: 1}, | ||
props: {c: 1}, // ideally it would fail because `c` is not an existing prop… | ||
props: {foo: 1}, | ||
data: () => ({b: 2}), | ||
@@ -74,0 +74,0 @@ slots: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30504
392
29