Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
b652812c
Commit
b652812c
authored
2 years ago
by
rhenck
Browse files
Options
Downloads
Patches
Plain Diff
Fix sanitizationService after refactor to service
parent
327d2810
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/common/services/id.service.spec.ts
+1
-1
1 addition, 1 deletion
projects/common/services/id.service.spec.ts
projects/common/services/sanitization.service.spec.ts
+25
-21
25 additions, 21 deletions
projects/common/services/sanitization.service.spec.ts
with
26 additions
and
22 deletions
projects/common/services/id.service.spec.ts
+
1
−
1
View file @
b652812c
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
IDService
}
from
'
common/services/i
-
d.service
'
;
import
{
IDService
}
from
'
common/services/id.service
'
;
describe
(
'
IDService
'
,
()
=>
{
describe
(
'
IDService
'
,
()
=>
{
let
service
:
IDService
;
let
service
:
IDService
;
...
...
This diff is collapsed.
Click to expand it.
projects/common/services/sanitization.service.spec.ts
+
25
−
21
View file @
b652812c
...
@@ -15,17 +15,6 @@ import * as sampleUnit112Droplists from 'test-data/test112-droplist.json';
...
@@ -15,17 +15,6 @@ import * as sampleUnit112Droplists from 'test-data/test112-droplist.json';
describe
(
'
SanitizationService
'
,
()
=>
{
describe
(
'
SanitizationService
'
,
()
=>
{
let
service
:
SanitizationService
;
let
service
:
SanitizationService
;
const
basicUnitDefinition
:
Unit
=
{
'
type
'
:
'
aspect-unit-definition
'
,
'
version
'
:
packageJSON
.
config
.
unit_definition_version
,
'
pages
'
:
[]
};
const
sanitizedUnit100
=
SanitizationService
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit100
)));
const
sanitizedUnit126
=
SanitizationService
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit126
)));
const
sanitizedUnit129
=
SanitizationService
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit129
)));
const
sanitizedUnit130
=
SanitizationService
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130
)));
beforeEach
(()
=>
{
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
SanitizationService
);
service
=
TestBed
.
inject
(
SanitizationService
);
...
@@ -36,6 +25,11 @@ describe('SanitizationService', () => {
...
@@ -36,6 +25,11 @@ describe('SanitizationService', () => {
});
});
it
(
'
isUnitDefinitionOutdated should return false on current version
'
,
()
=>
{
it
(
'
isUnitDefinitionOutdated should return false on current version
'
,
()
=>
{
const
basicUnitDefinition
:
Unit
=
{
'
type
'
:
'
aspect-unit-definition
'
,
'
version
'
:
packageJSON
.
config
.
unit_definition_version
,
'
pages
'
:
[]
};
expect
(
SanitizationService
.
isUnitDefinitionOutdated
(
basicUnitDefinition
)).
toBe
(
false
);
expect
(
SanitizationService
.
isUnitDefinitionOutdated
(
basicUnitDefinition
)).
toBe
(
false
);
});
});
...
@@ -49,7 +43,12 @@ describe('SanitizationService', () => {
...
@@ -49,7 +43,12 @@ describe('SanitizationService', () => {
});
});
it
(
'
sanitizeUnitDefinition should return basic unit definition
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should return basic unit definition
'
,
()
=>
{
expect
(
SanitizationService
.
sanitizeUnitDefinition
(
basicUnitDefinition
)).
toEqual
(
basicUnitDefinition
);
const
basicUnitDefinition
:
Unit
=
{
'
type
'
:
'
aspect-unit-definition
'
,
'
version
'
:
packageJSON
.
config
.
unit_definition_version
,
'
pages
'
:
[]
};
expect
(
service
.
sanitizeUnitDefinition
(
basicUnitDefinition
)).
toEqual
(
basicUnitDefinition
);
});
});
it
(
'
sanitizeUnitDefinition should return position
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should return position
'
,
()
=>
{
...
@@ -72,7 +71,7 @@ describe('SanitizationService', () => {
...
@@ -72,7 +71,7 @@ describe('SanitizationService', () => {
'
zIndex
'
:
0
'
zIndex
'
:
0
}
}
};
};
expect
(
SanitizationS
ervice
.
sanitizeUnitDefinition
(
testData130
).
pages
[
0
].
sections
[
0
].
elements
[
0
])
expect
(
s
ervice
.
sanitizeUnitDefinition
(
testData130
).
pages
[
0
].
sections
[
0
].
elements
[
0
])
.
toEqual
(
jasmine
.
objectContaining
(
expectedPositionProps
));
.
toEqual
(
jasmine
.
objectContaining
(
expectedPositionProps
));
});
});
...
@@ -85,6 +84,7 @@ describe('SanitizationService', () => {
...
@@ -85,6 +84,7 @@ describe('SanitizationService', () => {
'
gridRow
'
:
1
,
'
gridRow
'
:
1
,
'
gridRowRange
'
:
1
'
gridRowRange
'
:
1
};
};
const
sanitizedUnit126
=
service
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit126
)));
expect
(
Object
.
keys
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
expect
(
Object
.
keys
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
.
toContain
(
'
position
'
);
.
toContain
(
'
position
'
);
expect
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
expect
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
...
@@ -101,6 +101,7 @@ describe('SanitizationService', () => {
...
@@ -101,6 +101,7 @@ describe('SanitizationService', () => {
'
gridRow
'
:
3
,
'
gridRow
'
:
3
,
'
gridRowRange
'
:
1
'
gridRowRange
'
:
1
};
};
const
sanitizedUnit100
=
service
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit100
)));
expect
(
Object
.
keys
(
sanitizedUnit100
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
expect
(
Object
.
keys
(
sanitizedUnit100
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
.
toContain
(
'
position
'
);
.
toContain
(
'
position
'
);
expect
(
sanitizedUnit100
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
expect
(
sanitizedUnit100
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
...
@@ -111,13 +112,14 @@ describe('SanitizationService', () => {
...
@@ -111,13 +112,14 @@ describe('SanitizationService', () => {
// manipulate section prop first, so element needs to be corrected
// manipulate section prop first, so element needs to be corrected
const
unit
=
sampleUnit126
;
const
unit
=
sampleUnit126
;
unit
.
pages
[
0
].
sections
[
0
].
dynamicPositioning
=
true
;
unit
.
pages
[
0
].
sections
[
0
].
dynamicPositioning
=
true
;
const
sanitizedUnit
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
unit
)));
const
sanitizedUnit
=
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
unit
)));
expect
(
sanitizedUnit
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
expect
(
sanitizedUnit
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
.
toEqual
(
jasmine
.
objectContaining
({
.
toEqual
(
jasmine
.
objectContaining
({
'
dynamicPositioning
'
:
true
'
dynamicPositioning
'
:
true
}));
}));
// no change necessary
// no change necessary
const
sanitizedUnit129
=
service
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit129
)));
expect
(
sanitizedUnit129
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
expect
(
sanitizedUnit129
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
position
)
.
toEqual
(
jasmine
.
objectContaining
({
.
toEqual
(
jasmine
.
objectContaining
({
'
dynamicPositioning
'
:
false
'
dynamicPositioning
'
:
false
...
@@ -135,6 +137,7 @@ describe('SanitizationService', () => {
...
@@ -135,6 +137,7 @@ describe('SanitizationService', () => {
'
backgroundColor
'
:
'
transparent
'
,
'
backgroundColor
'
:
'
transparent
'
,
'
lineHeight
'
:
135
'
lineHeight
'
:
135
};
};
const
sanitizedUnit130
=
service
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130
)));
expect
(
Object
.
keys
(
sanitizedUnit130
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
expect
(
Object
.
keys
(
sanitizedUnit130
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
.
toContain
(
'
styling
'
);
.
toContain
(
'
styling
'
);
expect
(
sanitizedUnit130
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
styling
)
expect
(
sanitizedUnit130
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
styling
)
...
@@ -152,6 +155,7 @@ describe('SanitizationService', () => {
...
@@ -152,6 +155,7 @@ describe('SanitizationService', () => {
'
underline
'
:
false
,
'
underline
'
:
false
,
'
backgroundColor
'
:
'
red
'
'
backgroundColor
'
:
'
red
'
};
};
const
sanitizedUnit126
=
service
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit126
)));
expect
(
Object
.
keys
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
expect
(
Object
.
keys
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
]))
.
toContain
(
'
styling
'
);
.
toContain
(
'
styling
'
);
expect
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
styling
)
expect
(
sanitizedUnit126
.
pages
[
0
].
sections
[
0
].
elements
[
0
].
styling
)
...
@@ -160,7 +164,7 @@ describe('SanitizationService', () => {
...
@@ -160,7 +164,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should return player properties
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should return player properties
'
,
()
=>
{
const
sanitizedUnit130Audio
=
const
sanitizedUnit130Audio
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130Audio
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130Audio
)));
const
expectedPlayerProps
=
{
const
expectedPlayerProps
=
{
'
autostart
'
:
false
,
'
autostart
'
:
false
,
'
autostartDelay
'
:
0
,
'
autostartDelay
'
:
0
,
...
@@ -179,7 +183,7 @@ describe('SanitizationService', () => {
...
@@ -179,7 +183,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should repair playerProps
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should repair playerProps
'
,
()
=>
{
const
sanitizedUnit126Audio
=
const
sanitizedUnit126Audio
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit126Audio
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit126Audio
)));
const
expectedPlayerProps
=
{
const
expectedPlayerProps
=
{
'
autostart
'
:
false
,
'
autostart
'
:
false
,
'
autostartDelay
'
:
0
,
'
autostartDelay
'
:
0
,
...
@@ -201,7 +205,7 @@ describe('SanitizationService', () => {
...
@@ -201,7 +205,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "none"
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "none"
'
,
()
=>
{
const
sanitizedUnit112Texts
=
const
sanitizedUnit112Texts
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
const
expectedTextProps
=
{
const
expectedTextProps
=
{
highlightableYellow
:
false
,
highlightableYellow
:
false
,
highlightableTurquoise
:
false
,
highlightableTurquoise
:
false
,
...
@@ -213,7 +217,7 @@ describe('SanitizationService', () => {
...
@@ -213,7 +217,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "highlightable"
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "highlightable"
'
,
()
=>
{
const
sanitizedUnit112Texts
=
const
sanitizedUnit112Texts
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
const
expectedTextProps
=
{
const
expectedTextProps
=
{
highlightableYellow
:
true
,
highlightableYellow
:
true
,
highlightableTurquoise
:
true
,
highlightableTurquoise
:
true
,
...
@@ -225,7 +229,7 @@ describe('SanitizationService', () => {
...
@@ -225,7 +229,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "strikable"
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should repair text element - interaction: "strikable"
'
,
()
=>
{
const
sanitizedUnit112Texts
=
const
sanitizedUnit112Texts
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112Texts
)));
const
expectedTextProps
=
{
const
expectedTextProps
=
{
highlightableYellow
:
true
,
highlightableYellow
:
true
,
highlightableTurquoise
:
false
,
highlightableTurquoise
:
false
,
...
@@ -237,7 +241,7 @@ describe('SanitizationService', () => {
...
@@ -237,7 +241,7 @@ describe('SanitizationService', () => {
it
(
'
sanitizeUnitDefinition should return text field element
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should return text field element
'
,
()
=>
{
const
sanitizedUnit130TextFields
=
const
sanitizedUnit130TextFields
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130TextFields
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit130TextFields
)));
expect
(
sanitizedUnit130TextFields
.
pages
[
0
].
sections
[
0
].
elements
[
0
])
expect
(
sanitizedUnit130TextFields
.
pages
[
0
].
sections
[
0
].
elements
[
0
])
.
toEqual
(
jasmine
.
objectContaining
({
.
toEqual
(
jasmine
.
objectContaining
({
'
inputAssistancePreset
'
:
'
none
'
,
'
inputAssistancePreset
'
:
'
none
'
,
...
@@ -261,7 +265,7 @@ describe('SanitizationService', () => {
...
@@ -261,7 +265,7 @@ describe('SanitizationService', () => {
// only french inputAssistance is corrected to false, since the default is true
// only french inputAssistance is corrected to false, since the default is true
it
(
'
sanitizeUnitDefinition should repair text field and area elements
'
,
()
=>
{
it
(
'
sanitizeUnitDefinition should repair text field and area elements
'
,
()
=>
{
const
sanitizedUnit112TextFields
=
const
sanitizedUnit112TextFields
=
SanitizationS
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112TextFields
)));
s
ervice
.
sanitizeUnitDefinition
(
JSON
.
parse
(
JSON
.
stringify
(
sampleUnit112TextFields
)));
expect
(
sanitizedUnit112TextFields
.
pages
[
0
].
sections
[
0
].
elements
[
0
])
expect
(
sanitizedUnit112TextFields
.
pages
[
0
].
sections
[
0
].
elements
[
0
])
.
toEqual
(
jasmine
.
objectContaining
({
.
toEqual
(
jasmine
.
objectContaining
({
'
inputAssistancePreset
'
:
'
none
'
,
'
inputAssistancePreset
'
:
'
none
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment