import angular from 'angular';
import 'angular-translate';
import '@ovh-ux/ui-kit';
import component from './notebook-attach.component';
const moduleName = 'ovhManagerPciProjectNotebooksNotebookAttach';
angular
.module(moduleName, ['oui', 'pascalprecht.translate'])
.component('notebookAttach', component)
.run(/* @ngTranslationsInject:json ./translations */);
export default moduleName;
import {Component, NgModule} from '@angular/core'
import {render, screen} from '@testing-library/angular'
import {ngMocks} from 'ng-mocks'
@Component({
selector: 'app-parent-component',
template: '<app-child-component></app-child-component>',
})
class ParentComponent {}
@Component({
selector: 'app-child-component',
template: '<p>Child component</p>',
})
class ChildComponent {}
@NgModule({
declarations: [ParentComponent, ChildComponent],
})
export class AppModule {}
describe('ParentComponent', () => {
it('should not render ChildComponent when shallow rendering', async () => {
const dependencies = ngMocks.guts(null, AppModule, ParentComponent)
await render(ParentComponent, dependencies)
expect(screen.queryByText('Child component')).toBeNull()
})
})
AngularATGenerator = yeoman.extend({
//loging the AT greeting message
greeting: function () {
this.log(yosay(
'Welcome to the awesome ' + chalk.red('AT Angular') + ' generator!'
));
},
//exteding yoemen generator with custom code
constructor: function () {
yeoman.apply(this, arguments);
// Define arguments
this.argument('appName', {
type: String,
required: false
});
this.atVersion = pkg.version;
this.props = {};
this.composeWith('git-init', {}, {
local: require.resolve('generator-git-init')
});
}
})
import {render, screen, fireEvent} from '@testing-library/angular'
import {CounterComponent} from './counter.component.ts'
describe('Counter', () => {
test('should render counter', async () => {
await render(CounterComponent, {
componentProperties: {counter: 5},
})
expect(screen.getByText('Current Count: 5'))
})
test('should increment the counter on click', async () => {
await render(CounterComponent, {
componentProperties: {counter: 5},
})
fireEvent.click(screen.getByText('+'))
expect(screen.getByText('Current Count: 6'))
})
})
//...
angular.module('app', []);
angular.element(document).ready(() => angular.bootstrap(document, ['app']));
//...