@testgorilla/tgo-coding-test 0.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +2 -1
- package/README.md +49 -2
- package/jest.config.ts +6 -1
- package/package.json +14 -19
- package/project.json +12 -0
- package/src/lib/components/code-editor/code-editor.component.ts +5 -6
- package/src/lib/components/coding-question/coding-question.component.scss +12 -13
- package/src/lib/components/coding-question/coding-question.component.ts +12 -13
- package/src/lib/components/coding-section/coding-section.component.ts +14 -15
- package/src/lib/components/common/truncated-text/truncated-text.component.ts +5 -6
- package/src/lib/components/configurations/configurations.component.ts +12 -13
- package/src/lib/components/instructions/instructions.component.scss +7 -1
- package/src/lib/components/instructions/instructions.component.ts +11 -12
- package/src/lib/components/panel/panel.component.ts +5 -6
- package/src/lib/components/runnable-editor/runnable-editor.component.ts +11 -12
- package/src/lib/components/tests/test-cases/test-cases.component.ts +12 -13
- package/src/lib/components/tests/test-cases-content/test-cases-content.component.ts +12 -13
- package/src/lib/components/tests/test-cases-status/test-cases-status.component.ts +5 -6
- package/src/lib/components/tests/test-results.component.ts +19 -20
- package/src/lib/components/tgo-coding-test/tgo-coding-test.component.ts +11 -12
- package/src/lib/components/tgo-coding-test-candidate-view/tgo-coding-test-candidate-view.component.ts +29 -26
- package/src/lib/services/storage.service.spec.ts +12 -13
- package/src/test-setup.ts +3 -1
- package/tsconfig.json +4 -1
- package/tsconfig.lib.json +9 -2
- package/tsconfig.lib.prod.json +2 -1
- package/tsconfig.spec.json +6 -2
package/.eslintrc.json
CHANGED
package/README.md
CHANGED
|
@@ -113,6 +113,54 @@ import { TgoCodingTestCandidateViewComponent } from '@testgorilla/tgo-coding-tes
|
|
|
113
113
|
export class MyComponent {}
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Assets (translations)
|
|
117
|
+
|
|
118
|
+
This package ships its translations under `assets/i18n`. Consumer apps must copy these assets into their build output so Transloco can load them at runtime.
|
|
119
|
+
|
|
120
|
+
- **Angular CLI / Nx**: add an `assets` entry pointing at the package:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"assets": [
|
|
125
|
+
"src/favicon.ico",
|
|
126
|
+
"src/assets",
|
|
127
|
+
{
|
|
128
|
+
"glob": "**/*",
|
|
129
|
+
"input": "node_modules/@testgorilla/tgo-coding-test/assets",
|
|
130
|
+
"output": "assets/tgo-coding-test"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
If you develop inside this repo (consuming the workspace sources), also include the local path:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"glob": "**/*",
|
|
141
|
+
"input": "packages/tgo-coding-test/src/assets",
|
|
142
|
+
"output": "assets/tgo-coding-test"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
After adding the asset entries, rebuild/re-serve your app so `/assets/tgo-coding-test/i18n/en.json` is available.
|
|
147
|
+
|
|
148
|
+
## Mocking ApiService for demo/local runs
|
|
149
|
+
|
|
150
|
+
The candidate view includes a mocked API service for demos. To use it:
|
|
151
|
+
|
|
152
|
+
1. In `tgo-coding-test-candidate-view.component.ts`, uncomment the mock provider and comment the real one:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// use MockedApiService for local demo only
|
|
156
|
+
{ provide: ApiService, useClass: MockedApiService },
|
|
157
|
+
// ApiService,
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
2. Ensure `MockedApiService` is imported at the top of the file.
|
|
161
|
+
|
|
162
|
+
This lets the component run without live backend calls when serving the demo app.
|
|
163
|
+
|
|
116
164
|
## API
|
|
117
165
|
|
|
118
166
|
### TgoCodingTestComponent
|
|
@@ -196,7 +244,6 @@ This library requires the following peer dependencies:
|
|
|
196
244
|
- `@angular/router` ^18.2.13
|
|
197
245
|
- `@ngneat/transloco` ~4.3.0
|
|
198
246
|
- `@ngneat/until-destroy` 10.0.0
|
|
199
|
-
- `@testgorilla/tgo-test-shared` ^0.0.1
|
|
200
247
|
- `@testgorilla/tgo-ui` ^3.0.0
|
|
201
248
|
- `angular-split` ^18.0.0
|
|
202
249
|
- `monaco-editor` 0.50.0
|
|
@@ -218,7 +265,7 @@ All required services, models, and components are included within this library:
|
|
|
218
265
|
- `CoderunnerApiService` - API service for code execution
|
|
219
266
|
- `CodingTestConfigService` - Provides access to library configuration (injects configuration token internally)
|
|
220
267
|
- `ThemeService` - Provides theme/company color configuration
|
|
221
|
-
- `Question`, `TestResultRead`, `Assessment`, `ISubmissionState` - Type definitions from
|
|
268
|
+
- `Question`, `TestResultRead`, `Assessment`, `ISubmissionState` - Type definitions (bundled from shared code)
|
|
222
269
|
- `CodeEditorComponent`, `CodingQuestionComponent`, `RunnableEditorComponent` - UI components
|
|
223
270
|
- `TranslocoLazyModuleUtils`, `getAvailableLangs` - Translation utilities
|
|
224
271
|
|
package/jest.config.ts
CHANGED
|
@@ -12,7 +12,12 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
moduleNameMapper: {
|
|
16
|
+
'^@testgorilla/tgo-test-shared$': '<rootDir>/src/shared/index.ts',
|
|
17
|
+
},
|
|
18
|
+
transformIgnorePatterns: [
|
|
19
|
+
'node_modules/(?!.*\\.mjs$|lodash-es|@testgorilla/tgo-ui|ng2-charts|quill|ngx-quill|parchment)',
|
|
20
|
+
],
|
|
16
21
|
snapshotSerializers: [
|
|
17
22
|
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
18
23
|
'jest-preset-angular/build/serializers/ng-snapshot',
|
package/package.json
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testgorilla/tgo-coding-test",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/animations": "^
|
|
6
|
-
"@angular/common": "^
|
|
7
|
-
"@angular/core": "^
|
|
8
|
-
"@angular/forms": "^
|
|
9
|
-
"@angular/material": "
|
|
10
|
-
"@angular/router": "^
|
|
5
|
+
"@angular/animations": "^19.2.17",
|
|
6
|
+
"@angular/common": "^19.2.17",
|
|
7
|
+
"@angular/core": "^19.2.17",
|
|
8
|
+
"@angular/forms": "^19.2.17",
|
|
9
|
+
"@angular/material": "19.2.19",
|
|
10
|
+
"@angular/router": "^19.2.17",
|
|
11
11
|
"@ngneat/transloco": "~4.3.0",
|
|
12
12
|
"@ngneat/until-destroy": "10.0.0",
|
|
13
|
-
"@testgorilla/tgo-
|
|
14
|
-
"
|
|
15
|
-
"angular
|
|
16
|
-
"
|
|
17
|
-
"monaco-editor": "0.50.0",
|
|
13
|
+
"@testgorilla/tgo-ui": "^4.0.0",
|
|
14
|
+
"angular-split": "^19.0.0",
|
|
15
|
+
"jest-preset-angular": "14.4.2",
|
|
16
|
+
"monaco-editor": "0.52.2",
|
|
18
17
|
"ngx-guided-tour": "^2.0.1",
|
|
19
|
-
"ngx-monaco-editor-v2": "^
|
|
20
|
-
"ngx-quill": "^
|
|
21
|
-
"ngx-webstorage": "^
|
|
18
|
+
"ngx-monaco-editor-v2": "^19.0.2",
|
|
19
|
+
"ngx-quill": "^27.1.2",
|
|
20
|
+
"ngx-webstorage": "^19.0.1",
|
|
22
21
|
"quill": "^2.0.3",
|
|
23
22
|
"rxjs": "~7.8.1"
|
|
24
23
|
},
|
|
25
24
|
"sideEffects": false,
|
|
26
25
|
"license": "PROPRIETARY",
|
|
27
|
-
"publishConfig": {
|
|
28
|
-
"access": "restricted",
|
|
29
|
-
"registry": "https://registry.npmjs.org/"
|
|
30
|
-
},
|
|
31
26
|
"displayName": "Coding test",
|
|
32
27
|
"description": "Coding test component"
|
|
33
28
|
}
|
package/project.json
CHANGED
|
@@ -7,6 +7,18 @@
|
|
|
7
7
|
"tags": [],
|
|
8
8
|
"targets": {
|
|
9
9
|
"build": {
|
|
10
|
+
"executor": "nx:run-commands",
|
|
11
|
+
"outputs": ["{workspaceRoot}/dist/packages/tgo-coding-test"],
|
|
12
|
+
"options": {
|
|
13
|
+
"commands": [
|
|
14
|
+
"nx run tgo-coding-test:package",
|
|
15
|
+
"node scripts/replace-shared-alias.js dist/packages/tgo-coding-test @testgorilla/tgo-test-shared"
|
|
16
|
+
],
|
|
17
|
+
"parallel": false,
|
|
18
|
+
"forwardAllArgs": false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"package": {
|
|
10
22
|
"executor": "@nx/angular:package",
|
|
11
23
|
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
12
24
|
"options": {
|
|
@@ -33,12 +33,11 @@ import { CodingSnapshot } from './models/coding-snapshot.model';
|
|
|
33
33
|
|
|
34
34
|
@UntilDestroy()
|
|
35
35
|
@Component({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
imports: [CommonModule, FormsModule, MonacoEditorModule],
|
|
36
|
+
selector: 'tgo-code-editor',
|
|
37
|
+
templateUrl: './code-editor.component.html',
|
|
38
|
+
styleUrls: ['./code-editor.component.scss'],
|
|
39
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
40
|
+
imports: [CommonModule, FormsModule, MonacoEditorModule]
|
|
42
41
|
})
|
|
43
42
|
export class CodeEditorComponent implements OnInit, OnDestroy, OnChanges {
|
|
44
43
|
private readonly libCodingTestService = inject(LibCodingTestService);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import '../../styles/mixins';
|
|
2
2
|
|
|
3
3
|
@include as-split-styles();
|
|
4
4
|
|
|
@@ -8,21 +8,11 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.main-container {
|
|
11
|
-
$base: &;
|
|
12
11
|
height: 100%;
|
|
13
12
|
padding: 32px 50px 40px 50px;
|
|
14
13
|
display: flex;
|
|
15
14
|
justify-content: center;
|
|
16
15
|
|
|
17
|
-
&#{$base}-fullscreen {
|
|
18
|
-
padding: 0;
|
|
19
|
-
|
|
20
|
-
.main-card {
|
|
21
|
-
max-height: calc(100vh - 80px);
|
|
22
|
-
max-width: 100vw;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
16
|
&-mobile {
|
|
27
17
|
padding: 20px 16px 0;
|
|
28
18
|
}
|
|
@@ -32,7 +22,7 @@
|
|
|
32
22
|
height: 100%;
|
|
33
23
|
max-height: 750px;
|
|
34
24
|
max-width: 1280px;
|
|
35
|
-
padding: 0!important;
|
|
25
|
+
padding: 0 !important;
|
|
36
26
|
box-shadow: 0 8px 24px 4px rgba(0, 0, 0, 0.08);
|
|
37
27
|
background-color: var(--bg-mat-card) !important;
|
|
38
28
|
|
|
@@ -43,6 +33,15 @@
|
|
|
43
33
|
max-height: 100%;
|
|
44
34
|
}
|
|
45
35
|
}
|
|
36
|
+
|
|
37
|
+
&-fullscreen {
|
|
38
|
+
padding: 0;
|
|
39
|
+
|
|
40
|
+
.main-card {
|
|
41
|
+
max-height: calc(100vh - 80px);
|
|
42
|
+
max-width: 100vw;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
.fullscreen-btn {
|
|
@@ -73,4 +72,4 @@
|
|
|
73
72
|
fill: var(--icon-bg-color);
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
}
|
|
75
|
+
}
|
|
@@ -32,19 +32,18 @@ import { RunnableEditorComponent } from '../runnable-editor/runnable-editor.comp
|
|
|
32
32
|
|
|
33
33
|
@UntilDestroy()
|
|
34
34
|
@Component({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
],
|
|
35
|
+
selector: 'tgo-coding-question',
|
|
36
|
+
templateUrl: './coding-question.component.html',
|
|
37
|
+
styleUrls: ['./coding-question.component.scss'],
|
|
38
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
+
imports: [
|
|
40
|
+
CommonModule,
|
|
41
|
+
MatCardModule,
|
|
42
|
+
AngularSplitModule,
|
|
43
|
+
ButtonComponentModule,
|
|
44
|
+
InstructionsComponent,
|
|
45
|
+
RunnableEditorComponent,
|
|
46
|
+
]
|
|
48
47
|
})
|
|
49
48
|
export class CodingQuestionComponent implements OnInit, OnDestroy {
|
|
50
49
|
private readonly changeDetectorRef = inject(ChangeDetectorRef);
|
|
@@ -28,21 +28,20 @@ import { CodeEditorComponent } from '../code-editor/code-editor.component';
|
|
|
28
28
|
|
|
29
29
|
@UntilDestroy()
|
|
30
30
|
@Component({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
],
|
|
31
|
+
selector: 'tgo-coding-section',
|
|
32
|
+
templateUrl: './coding-section.component.html',
|
|
33
|
+
styleUrls: ['./coding-section.component.scss'],
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
+
imports: [
|
|
36
|
+
CommonModule,
|
|
37
|
+
ReactiveFormsModule,
|
|
38
|
+
TooltipComponentModule,
|
|
39
|
+
DropdownComponentModule,
|
|
40
|
+
ButtonComponentModule,
|
|
41
|
+
SpinnerComponentModule,
|
|
42
|
+
MemoizeFuncPipe,
|
|
43
|
+
CodeEditorComponent,
|
|
44
|
+
]
|
|
46
45
|
})
|
|
47
46
|
export class CodingSectionComponent implements OnInit, OnChanges {
|
|
48
47
|
private readonly configurationsService = inject(ConfigurationsService);
|
|
@@ -5,12 +5,11 @@ import { MemoizeFuncPipe } from '../../../pipes/memoize-func.pipe';
|
|
|
5
5
|
const DEFAULT_MAX_CHARACTERS = 135;
|
|
6
6
|
|
|
7
7
|
@Component({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
imports: [CommonModule, MemoizeFuncPipe],
|
|
8
|
+
selector: 'tgo-truncated-text',
|
|
9
|
+
templateUrl: './truncated-text.component.html',
|
|
10
|
+
styleUrls: ['./truncated-text.component.scss'],
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
imports: [CommonModule, MemoizeFuncPipe]
|
|
14
13
|
})
|
|
15
14
|
export class TruncatedTextComponent implements OnChanges {
|
|
16
15
|
@Input() text = '';
|
|
@@ -14,19 +14,18 @@ import { PanelComponent } from '../panel/panel.component';
|
|
|
14
14
|
|
|
15
15
|
@UntilDestroy()
|
|
16
16
|
@Component({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
],
|
|
17
|
+
selector: 'tgo-code-configurations',
|
|
18
|
+
templateUrl: 'configurations.component.html',
|
|
19
|
+
styleUrls: ['configurations.component.scss'],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
imports: [
|
|
22
|
+
CommonModule,
|
|
23
|
+
ReactiveFormsModule,
|
|
24
|
+
DropdownComponentModule,
|
|
25
|
+
ToggleComponentModule,
|
|
26
|
+
MemoizeFuncPipe,
|
|
27
|
+
PanelComponent,
|
|
28
|
+
]
|
|
30
29
|
})
|
|
31
30
|
export class ConfigurationsComponent implements OnInit {
|
|
32
31
|
private readonly fb = inject(FormBuilder);
|
|
@@ -131,6 +131,12 @@
|
|
|
131
131
|
height: auto;
|
|
132
132
|
.table-q {
|
|
133
133
|
width: 100%;
|
|
134
|
+
|
|
135
|
+
@supports (-moz-appearance: none) {
|
|
136
|
+
// Firefox-specific override - fix table collapsed width
|
|
137
|
+
width: auto;
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
border-collapse: collapse;
|
|
135
141
|
border-radius: 5px;
|
|
136
142
|
table-layout: fixed;
|
|
@@ -164,4 +170,4 @@
|
|
|
164
170
|
&.ql-blank::before {
|
|
165
171
|
color: var(--secondary-text-color);
|
|
166
172
|
}
|
|
167
|
-
}
|
|
173
|
+
}
|
|
@@ -23,18 +23,17 @@ class TGOTableContainer extends TableContainer {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@Component({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
],
|
|
26
|
+
selector: 'tgo-code-instructions',
|
|
27
|
+
templateUrl: 'instructions.component.html',
|
|
28
|
+
styleUrls: ['instructions.component.scss'],
|
|
29
|
+
imports: [
|
|
30
|
+
CommonModule,
|
|
31
|
+
QuillModule,
|
|
32
|
+
TooltipComponentModule,
|
|
33
|
+
IconComponentModule,
|
|
34
|
+
DividerComponentModule,
|
|
35
|
+
MemoizeFuncPipe,
|
|
36
|
+
]
|
|
38
37
|
})
|
|
39
38
|
export class InstructionsComponent implements OnInit {
|
|
40
39
|
private readonly libCodingTestService = inject(LibCodingTestService);
|
|
@@ -13,12 +13,11 @@ import { CommonModule } from '@angular/common';
|
|
|
13
13
|
import { ButtonComponentModule } from '@testgorilla/tgo-ui';
|
|
14
14
|
|
|
15
15
|
@Component({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
imports: [CommonModule, MatSidenavModule, ButtonComponentModule],
|
|
16
|
+
selector: 'tgo-code-panel',
|
|
17
|
+
templateUrl: 'panel.component.html',
|
|
18
|
+
styleUrls: ['panel.component.scss'],
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
imports: [CommonModule, MatSidenavModule, ButtonComponentModule]
|
|
22
21
|
})
|
|
23
22
|
export class PanelComponent implements OnChanges {
|
|
24
23
|
@Input() heading: string;
|
|
@@ -39,18 +39,17 @@ import { TestResultsComponent } from '../tests/test-results.component';
|
|
|
39
39
|
|
|
40
40
|
@UntilDestroy()
|
|
41
41
|
@Component({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
],
|
|
42
|
+
selector: 'tgo-runnable-editor',
|
|
43
|
+
templateUrl: './runnable-editor.component.html',
|
|
44
|
+
styleUrls: ['./runnable-editor.component.scss'],
|
|
45
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
46
|
+
imports: [
|
|
47
|
+
CommonModule,
|
|
48
|
+
AngularSplitModule,
|
|
49
|
+
CodingSectionComponent,
|
|
50
|
+
ConfigurationsComponent,
|
|
51
|
+
TestResultsComponent,
|
|
52
|
+
]
|
|
54
53
|
})
|
|
55
54
|
export class RunnableEditorComponent implements AfterViewInit {
|
|
56
55
|
@Input() initCode: string;
|
|
@@ -29,19 +29,18 @@ import { TestCasesContentComponent } from '../test-cases-content/test-cases-cont
|
|
|
29
29
|
|
|
30
30
|
@UntilDestroy()
|
|
31
31
|
@Component({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
32
|
+
selector: 'tgo-test-cases',
|
|
33
|
+
templateUrl: 'test-cases.component.html',
|
|
34
|
+
styleUrls: ['test-cases.component.scss'],
|
|
35
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36
|
+
imports: [
|
|
37
|
+
CommonModule,
|
|
38
|
+
MatTabsModule,
|
|
39
|
+
IconComponentModule,
|
|
40
|
+
ButtonComponentModule,
|
|
41
|
+
TestCasesStatusComponent,
|
|
42
|
+
TestCasesContentComponent,
|
|
43
|
+
]
|
|
45
44
|
})
|
|
46
45
|
export class TestCasesComponent implements OnInit, OnChanges {
|
|
47
46
|
@Input() exampleTestCases: ExampleTestCase[];
|
|
@@ -26,19 +26,18 @@ import { TestCasesStatusComponent } from '../test-cases-status/test-cases-status
|
|
|
26
26
|
|
|
27
27
|
@UntilDestroy()
|
|
28
28
|
@Component({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
],
|
|
29
|
+
selector: 'tgo-test-cases-content',
|
|
30
|
+
templateUrl: './test-cases-content.component.html',
|
|
31
|
+
styleUrls: ['./test-cases-content.component.scss'],
|
|
32
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
|
+
imports: [
|
|
34
|
+
CommonModule,
|
|
35
|
+
ReactiveFormsModule,
|
|
36
|
+
FieldComponentModule,
|
|
37
|
+
MemoizeFuncPipe,
|
|
38
|
+
TruncatedTextComponent,
|
|
39
|
+
TestCasesStatusComponent,
|
|
40
|
+
]
|
|
42
41
|
})
|
|
43
42
|
export class TestCasesContentComponent implements OnInit, OnChanges {
|
|
44
43
|
private readonly fb = inject(FormBuilder);
|
|
@@ -3,12 +3,11 @@ import { IconLabelComponentModule } from '@testgorilla/tgo-ui';
|
|
|
3
3
|
import { TestCaseStatus } from '../../../models/test-cases';
|
|
4
4
|
|
|
5
5
|
@Component({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
imports: [IconLabelComponentModule],
|
|
6
|
+
selector: 'tgo-test-cases-status',
|
|
7
|
+
templateUrl: './test-cases-status.component.html',
|
|
8
|
+
styleUrls: ['./test-cases-status.component.scss'],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
imports: [IconLabelComponentModule]
|
|
12
11
|
})
|
|
13
12
|
export class TestCasesStatusComponent {
|
|
14
13
|
@Input() status: TestCaseStatus;
|
|
@@ -11,26 +11,25 @@ import { TestCasesComponent } from './test-cases/test-cases.component';
|
|
|
11
11
|
|
|
12
12
|
@UntilDestroy()
|
|
13
13
|
@Component({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]
|
|
33
|
-
],
|
|
14
|
+
selector: 'tgo-code-test-results',
|
|
15
|
+
templateUrl: 'test-results.component.html',
|
|
16
|
+
styleUrls: ['test-results.component.scss'],
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
imports: [
|
|
19
|
+
CommonModule,
|
|
20
|
+
ButtonComponentModule,
|
|
21
|
+
ProgressBarComponentModule,
|
|
22
|
+
MemoizeFuncPipe,
|
|
23
|
+
TestCasesComponent,
|
|
24
|
+
],
|
|
25
|
+
animations: [
|
|
26
|
+
trigger('slideInOut', [
|
|
27
|
+
transition(':enter', [
|
|
28
|
+
style({ transform: 'translateY(100%)', opacity: '0' }),
|
|
29
|
+
animate('500ms ease', style({ transform: 'translateY(0)', opacity: '1' })),
|
|
30
|
+
]),
|
|
31
|
+
]),
|
|
32
|
+
]
|
|
34
33
|
})
|
|
35
34
|
export class TestResultsComponent implements OnInit {
|
|
36
35
|
@Input() companyColor: string;
|
|
@@ -38,18 +38,17 @@ import { RunnableEditorComponent } from '../runnable-editor/runnable-editor.comp
|
|
|
38
38
|
|
|
39
39
|
@UntilDestroy()
|
|
40
40
|
@Component({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
],
|
|
41
|
+
selector: 'tgo-coding-test[languages]',
|
|
42
|
+
templateUrl: './tgo-coding-test.component.html',
|
|
43
|
+
styleUrl: './tgo-coding-test.component.scss',
|
|
44
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
+
encapsulation: ViewEncapsulation.None,
|
|
46
|
+
imports: [
|
|
47
|
+
CommonModule,
|
|
48
|
+
CodeEditorComponent,
|
|
49
|
+
CodingQuestionComponent,
|
|
50
|
+
RunnableEditorComponent,
|
|
51
|
+
]
|
|
53
52
|
})
|
|
54
53
|
export class TgoCodingTestComponent implements OnInit, OnChanges {
|
|
55
54
|
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import {
|
|
3
3
|
Component,
|
|
4
|
+
computed,
|
|
4
5
|
EventEmitter,
|
|
5
6
|
HostBinding,
|
|
7
|
+
inject,
|
|
6
8
|
Input,
|
|
7
9
|
OnDestroy,
|
|
8
10
|
OnInit,
|
|
9
11
|
Output,
|
|
10
12
|
signal,
|
|
11
13
|
ViewEncapsulation,
|
|
12
|
-
computed,
|
|
13
|
-
inject,
|
|
14
14
|
} from '@angular/core';
|
|
15
15
|
import { ActivatedRoute, RouterModule } from '@angular/router';
|
|
16
16
|
import { translate, TRANSLOCO_SCOPE, TranslocoModule, TranslocoService } from '@ngneat/transloco';
|
|
17
17
|
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
|
|
18
|
-
import {
|
|
19
|
-
ApplicationTheme,
|
|
20
|
-
ConfirmDialogComponent,
|
|
21
|
-
DialogComponentModule,
|
|
22
|
-
DialogService,
|
|
23
|
-
SnackbarComponentModule,
|
|
24
|
-
} from '@testgorilla/tgo-ui';
|
|
25
18
|
import {
|
|
26
19
|
ApiService,
|
|
27
20
|
Assessment,
|
|
@@ -38,37 +31,43 @@ import {
|
|
|
38
31
|
ThemeService,
|
|
39
32
|
TranslocoLazyModuleUtils,
|
|
40
33
|
} from '@testgorilla/tgo-test-shared';
|
|
34
|
+
import {
|
|
35
|
+
ApplicationTheme,
|
|
36
|
+
ConfirmDialogComponent,
|
|
37
|
+
DialogComponentModule,
|
|
38
|
+
DialogService,
|
|
39
|
+
SnackbarComponentModule,
|
|
40
|
+
} from '@testgorilla/tgo-ui';
|
|
41
41
|
import { GuidedTourModule, GuidedTourService } from 'ngx-guided-tour';
|
|
42
42
|
import { interval, Observable, Subscription } from 'rxjs';
|
|
43
43
|
import { switchMap, take, tap } from 'rxjs/operators';
|
|
44
44
|
|
|
45
45
|
import { CodingTestsResultsModel } from '../../models/coderunner-execution-results';
|
|
46
|
+
import { LATLanguages } from '../../models/lat-languages';
|
|
47
|
+
import { Modes } from '../../models/mode';
|
|
46
48
|
import { PasteData } from '../../models/paste-data';
|
|
47
49
|
import {
|
|
48
50
|
ProgrammingLanguage,
|
|
49
51
|
ProgrammingLanguageVersioned,
|
|
50
52
|
} from '../../models/programming-language';
|
|
51
53
|
import { ExampleTestCase, SqlTestCase } from '../../models/test-cases';
|
|
54
|
+
import { Themes } from '../../models/theme';
|
|
52
55
|
import { ROOT_TRANSLATIONS_SCOPE } from '../../models/translations';
|
|
56
|
+
import { ViewMode } from '../../models/view-mode';
|
|
53
57
|
import {
|
|
54
|
-
CodingTestTourMode,
|
|
55
|
-
CodingTestTourService,
|
|
56
|
-
CodingTestService,
|
|
57
58
|
CandidatureApiService,
|
|
58
59
|
CoderunnerApiService,
|
|
60
|
+
CodingTestService,
|
|
61
|
+
CodingTestTourMode,
|
|
62
|
+
CodingTestTourService,
|
|
59
63
|
} from '../../services/candidate-coding-test-services';
|
|
64
|
+
import { CodingTestConfigService } from '../../services/coding-test-config.service';
|
|
65
|
+
import { LibCodingTestService } from '../../services/lib-coding-test.service';
|
|
60
66
|
import { CodeEditorLanguages } from '../code-editor/helpers/code-editor-helper.model';
|
|
61
|
-
import { Modes } from '../../models/mode';
|
|
62
|
-
import { Themes } from '../../models/theme';
|
|
63
|
-
import { LATLanguages } from '../../models/lat-languages';
|
|
64
|
-
import { ViewMode } from '../../models/view-mode';
|
|
65
67
|
import { TgoCodingTestComponent } from '../tgo-coding-test/tgo-coding-test.component';
|
|
66
|
-
import { LibCodingTestService } from '../../services/lib-coding-test.service';
|
|
67
|
-
import { CodingTestConfigService } from '../../services/coding-test-config.service';
|
|
68
68
|
|
|
69
69
|
@UntilDestroy()
|
|
70
70
|
@Component({
|
|
71
|
-
standalone: true,
|
|
72
71
|
selector: 'tgo-coding-test-candidate-view',
|
|
73
72
|
templateUrl: './tgo-coding-test-candidate-view.component.html',
|
|
74
73
|
styleUrls: ['./tgo-coding-test-candidate-view.component.scss'],
|
|
@@ -87,7 +86,12 @@ import { CodingTestConfigService } from '../../services/coding-test-config.servi
|
|
|
87
86
|
'tgo-coding-test',
|
|
88
87
|
getAvailableLangs(),
|
|
89
88
|
ROOT_TRANSLATIONS_SCOPE,
|
|
90
|
-
(lang: string) =>
|
|
89
|
+
(lang: string) => {
|
|
90
|
+
// Fetch from app assets; demo app copies the library assets to
|
|
91
|
+
// /assets/tgo-coding-test via project.json.
|
|
92
|
+
const url = new URL(`assets/tgo-coding-test/i18n/${lang}.json`, document.baseURI).href;
|
|
93
|
+
return fetch(url).then(res => res.json());
|
|
94
|
+
}
|
|
91
95
|
),
|
|
92
96
|
EnvironmentService,
|
|
93
97
|
CoderunnerApiService,
|
|
@@ -97,13 +101,13 @@ import { CodingTestConfigService } from '../../services/coding-test-config.servi
|
|
|
97
101
|
ThemeService,
|
|
98
102
|
CandidatureApiService,
|
|
99
103
|
MixpanelService,
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
// { provide: ApiService, useClass: MockedApiService },
|
|
103
|
-
ApiService,
|
|
104
|
+
// use MockedApiService for local demo ONLY
|
|
105
|
+
ApiService, //{ provide: ApiService, useClass: MockedApiService },
|
|
104
106
|
],
|
|
105
107
|
})
|
|
106
|
-
export class TgoCodingTestCandidateViewComponent
|
|
108
|
+
export class TgoCodingTestCandidateViewComponent
|
|
109
|
+
implements OnInit, IQuestionDataContract, OnDestroy
|
|
110
|
+
{
|
|
107
111
|
private readonly dialogService = inject(DialogService);
|
|
108
112
|
private readonly translationScope = inject(TRANSLOCO_SCOPE);
|
|
109
113
|
private readonly candidatureApiService = inject(CandidatureApiService);
|
|
@@ -572,4 +576,3 @@ export class TgoCodingTestCandidateViewComponent implements OnInit, IQuestionDat
|
|
|
572
576
|
}
|
|
573
577
|
}
|
|
574
578
|
}
|
|
575
|
-
|
|
@@ -675,22 +675,21 @@ describe('StorageCodingService', () => {
|
|
|
675
675
|
const storageSpy = jest.spyOn(storage, 'store');
|
|
676
676
|
|
|
677
677
|
libCodingTestService.changeCurrentCode(code);
|
|
678
|
-
const autoSavedData = { ...data };
|
|
679
|
-
autoSavedData.assessments[assessmentId] = {
|
|
680
|
-
'question-123': {
|
|
681
|
-
lastModified: Date.now(),
|
|
682
|
-
actual: {
|
|
683
|
-
code: {},
|
|
684
|
-
testCasesLAT: [],
|
|
685
|
-
lastModified: Date.now(),
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
};
|
|
689
|
-
autoSavedData.assessments[assessmentId]['question-123'].actual.code[CodeEditorLanguages.Python] = code;
|
|
690
678
|
expect(storageSpy).toBeCalledWith(
|
|
691
679
|
key,
|
|
692
680
|
expect.objectContaining({
|
|
693
|
-
assessments:
|
|
681
|
+
assessments: expect.objectContaining({
|
|
682
|
+
[assessmentId]: expect.objectContaining({
|
|
683
|
+
'question-123': expect.objectContaining({
|
|
684
|
+
actual: expect.objectContaining({
|
|
685
|
+
code: expect.objectContaining({
|
|
686
|
+
[CodeEditorLanguages.Python]: code,
|
|
687
|
+
}),
|
|
688
|
+
testCasesLAT: [],
|
|
689
|
+
}),
|
|
690
|
+
}),
|
|
691
|
+
}),
|
|
692
|
+
}),
|
|
694
693
|
})
|
|
695
694
|
);
|
|
696
695
|
});
|
package/src/test-setup.ts
CHANGED
package/tsconfig.json
CHANGED
package/tsconfig.lib.json
CHANGED
|
@@ -5,8 +5,15 @@
|
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"declarationMap": true,
|
|
7
7
|
"inlineSources": true,
|
|
8
|
-
"
|
|
8
|
+
"baseUrl": "../../",
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"paths": {
|
|
11
|
+
"@testgorilla/tgo-test-shared": ["packages/tgo-coding-test/src/shared/index.ts"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"angularCompilerOptions": {
|
|
15
|
+
"preserveWhitespaces": false
|
|
9
16
|
},
|
|
10
17
|
"exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"],
|
|
11
|
-
"include": ["src/**/*.ts"]
|
|
18
|
+
"include": ["src/**/*.ts", "src/shared/**/*.ts"]
|
|
12
19
|
}
|
package/tsconfig.lib.prod.json
CHANGED
package/tsconfig.spec.json
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
"target": "es2016",
|
|
7
7
|
"types": ["jest", "node"],
|
|
8
8
|
"resolveJsonModule": true,
|
|
9
|
-
"esModuleInterop": true
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"baseUrl": "../../",
|
|
11
|
+
"paths": {
|
|
12
|
+
"@testgorilla/tgo-test-shared": ["packages/tgo-coding-test/src/shared/index.ts"]
|
|
13
|
+
}
|
|
10
14
|
},
|
|
11
15
|
"files": ["src/test-setup.ts"],
|
|
12
|
-
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
|
|
16
|
+
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts", "src/shared/**/*.ts"]
|
|
13
17
|
}
|