Skip to content

Commit

Permalink
Merge pull request #18 from isaacplmann/declareComponent
Browse files Browse the repository at this point in the history
feat(sandbox): declareComponent flag
  • Loading branch information
jschwarty committed Mar 1, 2017
2 parents b76124f + 26c1f70 commit 74886d2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
@@ -1,3 +1,4 @@
import { SharedModule } from './shared.module';
import { sandboxOf } from 'angular-playground';
import { CounterService } from './counter.service';
import { NoticeComponent } from './notice.component';
Expand All @@ -8,7 +9,7 @@ class MockCounterService {
}
}

export default sandboxOf(NoticeComponent, {providers: [CounterService]})
export default sandboxOf(NoticeComponent, {imports: [SharedModule], declareComponent: false})
.add('short text', {
template: `<ex-notice>Notification</ex-notice>`
})
Expand Down
4 changes: 3 additions & 1 deletion src/api/api.ts
Expand Up @@ -3,6 +3,7 @@ export interface SandboxOfConfig {
imports?: any[];
declarations?: any[];
providers?: any[];
declareComponent?: boolean;
}

export interface ScenarioConfig {
Expand Down Expand Up @@ -43,7 +44,8 @@ export class SandboxBuilder {
prependText: this._config.prependText || '',
imports: this._config.imports || null,
declarations: this._config.declarations || null,
providers: this._config.providers || null
providers: this._config.providers || null,
declareComponent: this._config.declareComponent !== undefined ? this._config.declareComponent : true,
};
}
}
2 changes: 1 addition & 1 deletion src/app/scenario/scenario.component.ts
Expand Up @@ -65,7 +65,7 @@ export class ScenarioComponent {
imports ? imports : []
],
declarations: [
type,
...(sandbox.declareComponent ? [ type ] : []),
hostComponent,
declarations ? declarations : []
],
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/app-state.ts
Expand Up @@ -11,7 +11,8 @@ export interface Sandbox {
imports?: any[],
declarations?: any[],
scenarios: Scenario[],
providers?: any[]
providers?: any[],
declareComponent?: boolean,
}

export interface Scenario {
Expand Down

0 comments on commit 74886d2

Please sign in to comment.