Skip to content

Instantly share code, notes, and snippets.

@pmstss
Created July 19, 2020 15:27
Show Gist options
  • Save pmstss/51abb20ecc8867fac6521a3f66b7a5f9 to your computer and use it in GitHub Desktop.
Save pmstss/51abb20ecc8867fac6521a3f66b7a5f9 to your computer and use it in GitHub Desktop.
Test Task v2
<mat-selection-list>
<mat-list-option checkboxPosition="before">
<button mat-icon-button>
<mat-icon color="primary" [customTooltipTrigger]="tooltipSql">info</mat-icon>
</button>
SQL injection (SQLI)
</mat-list-option>
<mat-list-option checkboxPosition="before">
<button mat-icon-button>
<mat-icon color="primary" [customTooltipTrigger]="tooltipXss">info</mat-icon>
</button>
Cross-site scripting (XSS)
</mat-list-option>
</mat-selection-list>
<custom-tooltip #tooltipSql>
SQL injection is a code injection technique, used to attack data-driven applications,
in which malicious SQL statements are inserted into an entry field for execution
(e.g. to dump the database contents to the attacker).
SQL injection must exploit a security vulnerability in an application's software,
for example, when user input is either incorrectly filtered for string literal
escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed.
<br/>
<a target="_blank" href="https://en.wikipedia.org/wiki/SQL_injection">Wiki Link</a>
</custom-tooltip>
<custom-tooltip #tooltipXss>
Cross-site scripting (XSS) is a type of web application security vulnerability typically found in web applications.
XSS attacks enable attackers to inject client-side scripts into web pages viewed by other users.
A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy.
<br/>
<a target="_blank" href="https://en.wikipedia.org/wiki/Cross-site_scripting">Wiki Link</a>
</custom-tooltip>
@pmstss
Copy link
Author

pmstss commented Jul 19, 2020

For the given demo component template, please implement CustomTooltipComponent and CustomTooltipTriggerDirective with necessary styling so that it will look and behave like:

test-task-tooltip-gif

Requirements:

  • demo.component.html must not be changed
  • template of CustomTooltipComponent must have ng-template as root element, i. e.:
<ng-template>
<!-- here is your code -->
</ng-template>
  • only ChangeDetectionStrategy.OnPush
  • only ViewEncapsulation.Emulated
  • no setInterval/setTimeout usage

Please provide result as a link to github repo with Angular 10 app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment