-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add test control #2
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||
<div class="htf-layout-widget"> | ||||||
<div [@animateIn]="'in'" *ngIf="!testRunning() && hasTests()"> | ||||||
|
||||||
<div class="htf-layout-widget-header"> | ||||||
<div>Start new test</div> | ||||||
</div> | ||||||
|
||||||
<div class="htf-layout-widget-body"> | ||||||
<div class="dropdown" (mouseleave)="isDropdownOpen = false"> | ||||||
<input #response_field type="text" [style.display]="inline" class="u-push-top" [(ngModel)]="searchText" | ||||||
(input)="filterItems()" placeholder="Select test..." (click)="isDropdownOpen = true"> | ||||||
<ul *ngIf="isDropdownOpen" class="" dropdown-list> | ||||||
<li *ngFor="let item of filteredTests" (click)="selectItem(item)" [class.selected]="item === selectedValue" | ||||||
(mouseenter)="onMouseEnter(item)" (mouseleave)="onMouseLeave()"> | ||||||
{{item}} | ||||||
</li> | ||||||
</ul> | ||||||
</div> | ||||||
|
||||||
<div class="test-control-error-text u-push-top-third" *ngIf="error"> | ||||||
{{ error }} | ||||||
</div> | ||||||
|
||||||
<div class="u-text-align-right"> | ||||||
<button type="button" class="htf-rounded-button-grey u-push-top" (click)="sendTestStart(response_field)"> | ||||||
START | ||||||
</button> | ||||||
</div> | ||||||
|
||||||
</div> | ||||||
</div> | ||||||
|
||||||
<div [@animateIn]="'in'" *ngIf="testRunning()"> | ||||||
|
||||||
<div class="htf-layout-widget-body"> | ||||||
<div [innerHTML]="control"></div> | ||||||
|
||||||
<div class="u-font-size-large"> | ||||||
<button type="button" class="htf-rounded-button-red u-font-size-large" (click)="abort()"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: There's an extra space in the class attribute between 'htf-rounded-button-red' and 'u-font-size-large'.
Suggested change
|
||||||
ABORT TEST | ||||||
</button> | ||||||
</div> | ||||||
</div> | ||||||
</div> | ||||||
</div> |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Copyright 2022 Google LLC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@import 'vars'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Styling for lists injected into the prompt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
:host ::ng-deep ol, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
:host ::ng-deep ul { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
padding-left: 25px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider using more specific selectors to avoid potential conflicts with other components
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.test-control-has-error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border-color: $theme-red; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
&:focus { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border-color: darken($theme-red, 20%); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.test-control-error-text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: $theme-red; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font-size: $font-size-small; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.dropdown { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
position: relative; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ul { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list-style: none; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
padding: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
margin: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
max-height: 300px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
overflow-y: auto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border: 1px solid #ccc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border-top: none; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
border-radius: 0 0 4px 4px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
position: absolute; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
background-color: #fff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+43
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider using classes instead of element selectors for better specificity and reusability
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
padding: 10px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cursor: pointer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
transition: background-color 0.3s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+58
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider using a class selector for list items instead of the element selector
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li.selected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
background-color: #3498db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: #fff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li:hover { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
background-color: #f2f2f2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cursor: pointer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+69
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Redundant cursor property, already set on line 60
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
li:hover.selected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
background-color: #3498db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color: #fff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+74
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider combining this with the .selected class to reduce specificity
Suggested change
|
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.
logic: Using [innerHTML] can be a security risk if the content is not sanitized. Ensure 'control' is properly sanitized before binding.