Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Microsoft/powerbi-visuals-utils-testutils
Test utility interfaces for testing powerbi custom visuals
https://github.com/Microsoft/powerbi-visuals-utils-testutils
Last synced: about 1 month ago
JSON representation
Test utility interfaces for testing powerbi custom visuals
- Host: GitHub
- URL: https://github.com/Microsoft/powerbi-visuals-utils-testutils
- Owner: microsoft
- License: other
- Created: 2016-11-14T09:45:01.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-04-03T13:22:19.000Z (9 months ago)
- Last Synced: 2024-05-18T15:42:41.470Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 848 KB
- Stars: 16
- Watchers: 15
- Forks: 28
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-power-bi - TestUtils - visuals-utils-testutils)) — provides set of mocks and fakes in order to simplify creating unit tests for custom visuals. (Development / Utils)
README
# Microsoft Power BI visuals TestUtils
![Build](https://github.com/microsoft/powerbi-visuals-utils-testutils/workflows/build/badge.svg) [![npm version](https://img.shields.io/npm/v/powerbi-visuals-utils-testutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-testutils) [![npm](https://img.shields.io/npm/dm/powerbi-visuals-utils-testutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-testutils)> TestUtils is a set of mocks and fakes in order to simplify unit testing for Power BI custom visuals
## Usage
* [Usage Guide](https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-test)## 2.3.0 Migration note
From version 2.3.0 `testDom` function returns `HTMLElement` instead of `JQuery` object. If you are using JQuery in tests, wrap the `testDom` calls with `$(...)` for compatibility:
```typescript
// 2.2.1 and below
let element: JQuery = testDom("100", "100");
// 2.3.0 and above
let element: JQuery = $(testDom("100", "100"));
```The motivation is not to force JQuery usage. It might be not necessary in tests. In lots of cases `element.get(0)` is the next operation after receiving an element with `testDom`. Now JQuery is not required to use powerbi-visuals-utils-testutils, so you can drop this dependency. If you keep it, you can easily migrate your code to 2.3.* version using the example above.
## Contributing
* Read our [contribution guideline](./CONTRIBUTING.md) to find out how to contribute bugs fixes and improvements
* [Issue Tracker](https://github.com/Microsoft/powerbi-visuals-utils-testutils/issues)
* [Development workflow](./docs/dev/development-workflow.md)
* [How to build](./docs/dev/development-workflow.md#how-to-build)
* [How to run unit tests locally](./docs/dev/development-workflow.md#how-to-run-unit-tests-locally)## License
See the [LICENSE](./LICENSE) file for license rights and limitations (MIT).