Skip to content
Snippets Groups Projects
Commit 17f43f93 authored by Marc Hanisch's avatar Marc Hanisch
Browse files

removes IPathSetter implementation

parent cb6e4049
No related branches found
No related tags found
1 merge request!33Feature configuration models
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
}
......
......@@ -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')
})
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment