Comments (2)
Hi @mlz11,
thanks for highlighting the issue. Working on its fix.
from ng-mocks.
Hi @mlz11,
you can write a test like that:
describe('ng-mocks', () => {
beforeEach(() => MockBuilder([
NavbarComponent,
TranslocoModule,
], CoreModule)
.provide(getTranslocoModule().providers ?? [])
);
it('tests translation', () => {
const fixture = TestBed.createComponent(NavbarComponent);
fixture.detectChanges();
expect(fixture.nativeElement.innerHTML).toContain('<span>Hello</span>');
});
});
TranslocoTestingModule
uses TranslocoModule
with special providers.
So to keep TranslocoModule
in the test,
we just need to keep TranslocoModule
and to add providers from TranslocoTestingModule
.
from ng-mocks.
Related Issues (20)
- Bug: Overwriting defaultMock of 'get' or readonly property results in `Property ... does not have access type get` HOT 2
- Bug: Memory Leak HOT 2
- Bug: MockInstance doesn't manipulate the instance (findInstance works though) HOT 1
- MockInstance is not clear how spy methods get assigned Bug: HOT 1
- Feature Request: Should ngMocks set signals mocks to singal(null) rather than null? HOT 2
- Bug: Mocking standalone components may cause warnings HOT 6
- Feature Request: Support EnvironmentProviders in provide and HttpInterceptorFn exemple HOT 2
- Bug: MockInstance.scope(); is mentioned in "Getting started" doc although being unnecessary nowadays(?) HOT 7
- Bug: Angular 16 ngMocks.findInstance swallows original error HOT 2
- Bug: MockedComponentFixture is actually assignable to ComponentFixture contrary to what doc says HOT 3
- Feature Request: docs how to add a new angular version HOT 1
- Bug: ngMocks.findInstance unable to find instance (Angular 17) HOT 19
- Bug: Unable to install ng-mocks with Angular 17 HOT 9
- Feature request: Schematics HOT 1
- Update docs about animation HOT 8
- Tests on standalone component fails after update to 14.12.0 HOT 10
- Feature Request: improve docs about `await fixture.whenStable();` HOT 1
- Bug: investigate the issue HOT 2
- Bug: fixture.getDeferBlocks() returns no defer blocks if we want to use any ng-mocks mock inside the test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-mocks.