Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HUB Terra
SMS
Frontend
Commits
17f43f93
Commit
17f43f93
authored
4 years ago
by
Marc Hanisch
Browse files
Options
Downloads
Patches
Plain Diff
removes IPathSetter implementation
parent
cb6e4049
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!33
Feature configuration models
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/CustomTextField.ts
+1
-22
1 addition, 22 deletions
models/CustomTextField.ts
test/models/CustomTextField.test.ts
+0
-9
0 additions, 9 deletions
test/models/CustomTextField.test.ts
with
1 addition
and
31 deletions
models/CustomTextField.ts
+
1
−
22
View file @
17f43f93
import
IPathSetter
from
'
./IPathSetter
'
export
interface
ICustomTextField
{
key
:
string
,
value
:
string
}
export
class
CustomTextField
implements
ICustomTextField
,
IPathSetter
{
export
class
CustomTextField
implements
ICustomTextField
{
private
_key
:
string
=
''
private
_value
:
string
=
''
...
...
@@ -25,25 +23,6 @@ export class CustomTextField implements ICustomTextField, IPathSetter {
return
newObject
}
/**
* sets the value at the given path
*
* @param {string} path - the path (property name) to the value
* @param {any} value - the value to set
*/
setPath
(
path
:
string
,
value
:
any
):
void
{
switch
(
path
)
{
case
'
key
'
:
this
.
key
=
String
(
value
)
break
case
'
value
'
:
this
.
value
=
String
(
value
)
break
default
:
throw
new
TypeError
(
'
path
'
+
path
+
'
is not valid
'
)
}
}
get
key
():
string
{
return
this
.
_key
}
...
...
This diff is collapsed.
Click to expand it.
test/models/CustomTextField.test.ts
+
0
−
9
View file @
17f43f93
...
...
@@ -7,13 +7,4 @@ describe('CustomTextField', () => {
expect
(
textfield
).
toHaveProperty
(
'
key
'
,
'
foo
'
)
expect
(
textfield
).
toHaveProperty
(
'
value
'
,
'
bar
'
)
})
it
(
'
should set a property by its path
'
,
()
=>
{
const
textfield
=
new
CustomTextField
()
textfield
.
setPath
(
'
key
'
,
'
foo
'
)
textfield
.
setPath
(
'
value
'
,
'
bar
'
)
expect
(
textfield
).
toHaveProperty
(
'
key
'
,
'
foo
'
)
expect
(
textfield
).
toHaveProperty
(
'
value
'
,
'
bar
'
)
})
})
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