-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cockpit location ts #21276
base: main
Are you sure you want to change the base?
Cockpit location ts #21276
Conversation
jelly
commented
Nov 15, 2024
•
edited
Loading
edited
- remove arguments use
- Property 'replaceAll' does not exist on type 'string'.
- Rethink API, singleton?
- Solve A property name to write to depends on a user provided value
- solve
Locally I have this test failure to cleanup:
|
So in to sum this all up, the test code is:
More verbose test output is by adding a console.log to
So So this is why our tests fail. That leaves the question to why does this all happen. |
4ebff51
to
547af93
Compare
Prepare for moving cockpit.location to a separate typescript file named location.
Apparently String.prototype.replaceAll is an 2021 feature.
This function also allows `string[]` as can be seen by looking at how the code is used in our code.
547af93
to
9860d1c
Compare
if (window.mock?.url_root) | ||
this.url_root = window.mock.url_root; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test.
if (application.indexOf("cockpit+=") === 0) { | ||
if (this.url_root) | ||
this.url_root += '/'; | ||
this.url_root = this.url_root + application.replace("cockpit+", ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 added lines are not executed by any test.
} else if (part == "..") { | ||
if (out.length === 0) | ||
return []; | ||
out.pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 added lines are not executed by any test.
} else if (path instanceof Location) { | ||
return path.href; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test.
|
||
decode(href: string, options: Options) { | ||
if (href[0] == '#') | ||
href = href.substring(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
if (options[name]) { | ||
let last = options[name]; | ||
if (!Array.isArray(last)) | ||
last = options[name] = [last]; | ||
last.push(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 5 added lines are not executed by any test.
toString() { | ||
return this.href; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test.