angular-unit-test-helper
Advanced tools
Comparing version 11.0.1 to 11.0.2
@@ -1,1 +0,1 @@ | ||
{"processes":{"4c855b28-5fbb-44ac-86ae-ca20debb577b":{"parent":null,"children":[]},"f3c130c0-19d6-454b-9257-1e1764429a7d":{"parent":null,"children":[]}},"files":{"/home/circleci/repo/dist/addProperty.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/dist/autoSpyObj.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/dist/createComponentMock.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/dist/getAll.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/dist/index.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/dist/injectHelper.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/src/addProperty.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/src/autoSpyObj.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/src/createComponentMock.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/src/getAll.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/src/index.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/src/index.ts":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/src/injectHelper.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/tests/addProperty.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/tests/autoSpyObj.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/tests/createComponentMock.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/tests/getAll.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/tests/injectHelper.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"],"/home/circleci/repo/tests/testObjects.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b","f3c130c0-19d6-454b-9257-1e1764429a7d"],"/home/circleci/repo/tests/testObjects.spec.js":["4c855b28-5fbb-44ac-86ae-ca20debb577b"]},"externalIds":{}} | ||
{"processes":{"28d7254f-a780-4fc2-9d80-06bce0fadc3d":{"parent":null,"children":[]},"f615a090-8d7c-455b-a196-fb99851496c5":{"parent":null,"children":[]}},"files":{"/home/circleci/repo/dist/addProperty.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/dist/autoSpyObj.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/dist/createComponentMock.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/dist/getAll.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/dist/index.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/dist/injectHelper.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/src/addProperty.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/src/autoSpyObj.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/src/createComponentMock.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/src/getAll.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/src/index.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/src/index.ts":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/src/injectHelper.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/tests/addProperty.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/tests/autoSpyObj.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/tests/createComponentMock.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/tests/getAll.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/tests/injectHelper.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"],"/home/circleci/repo/tests/testObjects.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d","f615a090-8d7c-455b-a196-fb99851496c5"],"/home/circleci/repo/tests/testObjects.spec.js":["28d7254f-a780-4fc2-9d80-06bce0fadc3d"]},"externalIds":{}} |
@@ -1,1 +0,1 @@ | ||
export declare function createComponentMock(className: string, selectorName?: string, template?: string, windowRef?: unknown): any; | ||
export declare function createComponentMock(className: string, selectorName?: string, template?: string): any; |
import { Component } from '@angular/core'; | ||
import camelToKebabCase from 'camel-to-kebab'; | ||
import { __decorate } from 'tslib'; | ||
export function createComponentMock(className, selectorName, template, windowRef) { | ||
export function createComponentMock(className, selectorName, template) { | ||
if (template === void 0) { template = ''; } | ||
if (windowRef === void 0) { windowRef = function () { return window; }; } | ||
if (typeof windowRef === 'undefined' || | ||
(typeof windowRef === 'function' && typeof windowRef() === 'undefined')) { | ||
throw new Error('Window is not defined'); | ||
} | ||
if (!className || !className.endsWith('Component')) { | ||
@@ -17,5 +12,12 @@ throw new Error('Expected class name to end with Component, but it did not. Provide a valid component class name.'); | ||
} | ||
var newClass = (windowRef[className] = {}); | ||
var newClass = (getWindow()[className] = function () { }); | ||
return __decorate([Component({ selector: selectorName, template: template })], newClass); | ||
} | ||
function getWindow() { | ||
if (typeof window === 'undefined') { | ||
return {}; | ||
} | ||
/* istanbul ignore next */ | ||
return window; | ||
} | ||
function inferSelectorName(className) { | ||
@@ -22,0 +24,0 @@ className = className.replace('Component', ''); |
{ | ||
"name": "angular-unit-test-helper", | ||
"version": "11.0.1", | ||
"version": "11.0.2", | ||
"description": "Helper functions to help write unit tests in Angular using mocks and spies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,3 +7,3 @@ # Angular Unit Test Helper | ||
[![CircleCI](https://circleci.com/gh/duluca/angular-unit-test-helper.svg?style=svg)](https://circleci.com/gh/duluca/angular-unit-test-helper) | ||
[![Coverage Status](https://coveralls.io/repos/github/duluca/angular-unit-test-helper/badge.svg)](https://coveralls.io/github/duluca/angular-unit-test-helper) | ||
[![Coverage Status](https://coveralls.io/repos/github/duluca/angular-unit-test-helper/badge.svg?branch=master)](https://coveralls.io/github/duluca/angular-unit-test-helper?branch=master) | ||
@@ -10,0 +10,0 @@ ## Goal |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
630
204019