type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { let groupFixture: ComponentFixture<SelectWithGroups>; beforeEach(fakeAsync(() => { groupFixture = TestBed.createComponent(SelectWithGroups); groupFixture.detectChanges(); formField = groupFixture.debugElement.query(By.css('.mc-form-field'...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { groupFixture = TestBed.createComponent(SelectWithGroups); groupFixture.detectChanges(); formField = groupFixture.debugElement.query(By.css('.mc-form-field')).nativeElement; trigger = groupFixture.debugElement.query(By.css('.mc-select__trigger')).n...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { groupFixture.componentInstance.control.setValue('oddish-1'); groupFixture.detectChanges(); trigger.click(); groupFixture.detectChanges(); groupFixture.whenStable().then(() => { const group = document.querySele...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { const group = document.querySelector('.cdk-overlay-pane mc-optgroup')!; const triggerLeft: number = trigger.getBoundingClientRect().left; const selectedOptionLeft = group.querySelector('mc-option.mc-selected')! .getBoundingClie...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { dir.value = 'rtl'; groupFixture.componentInstance.control.setValue('oddish-1'); groupFixture.detectChanges(); trigger.click(); groupFixture.detectChanges(); flush(); const group = document.querySel...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { groupFixture.componentInstance.control.setValue('mime-11'); groupFixture.detectChanges(); trigger.click(); groupFixture.detectChanges(); flush(); const selected = document.querySelector('.c...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { // Push down the form field so there is space for the item to completely align. formField.style.top = '100px'; const menuItemHeight = 48; const triggerFontSize = 16; const triggerLineHeightEm = 1.125; const trigger...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => configureMcSelectTestingModule([MultiSelect])
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(MultiSelect); testInstance = fixture.componentInstance; fixture.detectChanges(); trigger = fixture.debugElement.query(By.css('.mc-select__trigger')).nativeElement; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[0].click(); options[2].click(); options[5].click(); fixture.detectChanges(); ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); const option = overlayContainerElement.querySelector('mc-option') as HTMLElement; option.click(); fixture.detectChanges(); expect(testInstance.control.value).toEqual(['steak-0']); o...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); flush(); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[0].click(); options[2].click(); options[5].click(); fixtur...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(item) => item.textContent!.trim()
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); testInstance.control.setValue(['steak-0', 'eggs-5']); fixture.detectChanges(); flush(); const optionNodes = overlayContainerElement.querySelectorAll('mc-option'); const optionInstances = testInstance.options.toArray(); ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[0].click(); fixture.detectChanges(); expect(options[0].classList).toContain('mc-selected')...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); expect(testInstance.select.panelOpen).toBe(true); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[0].click(); options[1].click(); ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); flush(); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[2].click(); options[0].click(); options[1].click(); fixtur...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { dir.value = 'rtl'; trigger.click(); fixture.detectChanges(); flush(); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[2].click(); options[0].click(); options...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { fixture.componentInstance.sortComparator = (a, b, optionsArray) => { return optionsArray.indexOf(b) - optionsArray.indexOf(a); }; fixture.detectChanges(); trigger.click(); fixture.detectChanges(); flush(); con...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(a, b, optionsArray) => { return optionsArray.indexOf(b) - optionsArray.indexOf(a); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); testInstance.control.setValue(['tacos-2', 'steak-0', 'pizza-1']); fixture.detectChanges(); flush(); // expect(trigger.querySelector('.mc-select__match-list')!.textContent....
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { dir.value = 'rtl'; trigger.click(); fixture.detectChanges(); testInstance.control.setValue(['tacos-2', 'steak-0', 'pizza-1']); fixture.detectChanges(); expect(trigger.textContent).toContain('Tacos, Pizza, Steak'); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { expect(() => { testInstance.control.setValue('not-an-array'); }).toThrowError(wrappedErrorMessage(getMcSelectNonArrayValueError())); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { testInstance.control.setValue('not-an-array'); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { expect(() => { testInstance.select.multiple = false; }).toThrowError(wrappedErrorMessage(getMcSelectDynamicMultipleError())); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { testInstance.select.multiple = false; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); flush(); expect(testInstance.options.toArray().every((option: any) => option.multiple)) .toBe(true, 'Expected `multiple` to have been added to initial set of options.'); testI...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(option: any) => option.multiple
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(option) => !!option.multiple
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { trigger.click(); fixture.detectChanges(); flush(); expect(fixture.componentInstance.select.keyManager.activeItemIndex).toBe(0); const options: NodeListOf<HTMLElement> = overlayContainerElement.querySelectorAll('mc-option'); options[2].c...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { fixture.componentInstance.foods = [ { value: null, viewValue: 'Steak' }, { value: 'pizza-1', viewValue: 'Pizza' }, { value: null, viewValue: 'Tacos' } ]; fixture.detectChanges(); trigger.click(); fixtur...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { const selectElement = fixture.nativeElement.querySelector('mc-select'); const options = fixture.componentInstance.options.toArray(); expect(testInstance.control.value).toBeFalsy(); expect(options.every((option) => option.selected)).toBe(false); fixt...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(option) => option.selected
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { const selectElement = fixture.nativeElement.querySelector('mc-select'); const options = fixture.componentInstance.options.toArray(); for (let i = 0; i < 3; i++) { options[i].disabled = true; } expect(testInstance.control.value).toBeF...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { const selectElement = fixture.nativeElement.querySelector('mc-select'); const options = fixture.componentInstance.options.toArray(); options[0].select(); fixture.detectChanges(); expect(testInstance.control.value).toEqual(['steak-0']); e...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
() => { const selectElement = fixture.nativeElement.querySelector('mc-select'); const options = fixture.componentInstance.options.toArray(); options.forEach((option) => option.select()); fixture.detectChanges(); expect(testInstance.control.value).toEqual([ ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
(option) => option.select()
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select', template: ` <div [style.height.px]="heightAbove"></div> <mc-form-field> <mc-select placeholder="Food" [formControl]="control" [required]="isRequired" [tabIndex]="tabIndexOverride" [panelClass]="panelClass"> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-events', template: ` <mc-form-field> <mc-select (openedChange)="openedChangeListener($event)" (opened)="openedListener()" (closed)="closedListener()"> <mc-option *ngFor="let food of foods" [value]...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'ng-model-select', template: ` <mc-form-field> <mc-select placeholder="Food" ngModel [disabled]="isDisabled"> <mc-option *ngFor="let food of foods" [value]="food.value">{{ food.viewValue }} </mc-option> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'many-selects', template: ` <mc-form-field> <mc-select placeholder="First"> <mc-option [value]="'one'">one</mc-option> <mc-option [value]="'two'">two</mc-option> </mc-select> </mc-form-field> <mc-form-field> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'ng-if-select', template: ` <div *ngIf="isShowing"> <mc-form-field> <mc-select placeholder="Food I want to eat right now" [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value"> {...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-change-event', template: ` <mc-form-field> <mc-select (selectionChange)="changeListener($event)"> <mc-option *ngFor="let food of foods" [value]="food">{{ food }}</mc-option> </mc-select> </mc-form-field> ` }) class ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-search', template: ` <mc-form-field> <mc-select #select [(value)]="singleSelectedWithSearch"> <mc-form-field mcSelectSearch> <input mcInput [formControl]="searchCtrl" ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'custom-select-accessor', template: ` <mc-form-field> <mc-select></mc-select> </mc-form-field>`, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CustomSelectAccessor, multi: true }] }) class CustomSelectAccessor implement...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'comp-with-custom-select', template: ` <custom-select-accessor [formControl]="ctrl"></custom-select-accessor>`, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: CustomSelectAccessor, multi: true }] }) class CompWithCustomSelect { ctrl = n...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-infinite-loop', template: ` <mc-form-field> <mc-select [(ngModel)]="value"></mc-select> </mc-form-field> <throws-error-on-init></throws-error-on-init> ` }) class SelectWithErrorSibling { value: string; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'throws-error-on-init', template: '' }) class ThrowsErrorOnInit implements OnInit { ngOnInit() { throw Error('Oh no!'); } }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select-on-push', changeDetection: ChangeDetectionStrategy.OnPush, template: ` <mc-form-field> <mc-select placeholder="Food" [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.view...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select-on-push-preselected', changeDetection: ChangeDetectionStrategy.OnPush, template: ` <mc-form-field> <mc-select placeholder="Food" [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value"> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'multi-select', template: ` <mc-form-field> <mc-select multiple placeholder="Food" [formControl]="control" [sortComparator]="sortComparator"> <mc-option *ngFor="let food of foods" [value]="food.value">{...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-plain-tabindex', template: ` <mc-form-field> <mc-select [tabIndex]="5"></mc-select> </mc-form-field>` }) class SelectWithPlainTabindex {}
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-early-sibling-access', template: ` <mc-form-field> <mc-select #select="mcSelect"></mc-select> </mc-form-field> <div *ngIf="select.selected"></div> ` }) class SelectEarlyAccessSibling { }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select-initially-hidden', template: ` <mc-form-field> <mc-select [style.display]="isVisible ? 'block' : 'none'"> <mc-option [value]="'value'">There are no other options</mc-option> </mc-select> </mc-form-field> ` }) class...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select-no-placeholder', template: ` <mc-form-field> <mc-select> <mc-option [value]="'value'">There are no other options</mc-option> </mc-select> </mc-form-field> ` }) class BasicSelectNoPlaceholder { }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'basic-select-with-theming', template: ` <mc-form-field [color]="theme"> <mc-select placeholder="Food"> <mc-option [value]="'steak'-0">Steak</mc-option> <mc-option [value]="'pizza'-1">Pizza</mc-option> </mc-select> <...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'reset-values-select', template: ` <mc-form-field> <mc-select placeholder="Food" [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <mc-select [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value">{{ food.viewValue }} </mc-option> </mc-select> </mc-form-field> ` }) class F...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-groups', template: ` <mc-form-field> <mc-select placeholder="Pokemon" [formControl]="control"> <mc-optgroup *ngFor="let group of pokemonTypes" [label]="group.name" [disabled]="group.disabled"> <mc-option *ngFor="let pok...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-groups', template: ` <mc-form-field> <mc-select placeholder="Pokemon" [formControl]="control"> <mc-optgroup *ngFor="let group of pokemonTypes" [label]="group.name" [disabled]="group.disabled"> <ng-container *ngFor="let ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <form> <mc-form-field> <mc-select [(ngModel)]="value"></mc-select> </mc-form-field> </form> ` }) class InvalidSelectInForm { value: any; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <form [formGroup]="formGroup"> <mc-form-field> <mc-select placeholder="Food" formControlName="food"> <mc-option [value]="'steak'-0">Steak</mc-option> <mc-option [value]="'pizza'-1">Pizza</mc-option> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <mc-select placeholder="Food" [(value)]="selectedFood"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> </mc-select> </mc-form-field> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <mc-select placeholder="Food" [(value)]="selectedFood"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> </mc-select> </mc-form-field> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <mc-select placeholder="Food" [(value)]="selectedFoods" multiple> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> </mc-select> </mc-form...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-with-custom-trigger', template: ` <mc-form-field> <mc-select placeholder="Food" [formControl]="control" #select="mcSelect"> <mc-select__trigger> {{ select.selected?.viewValue.split('').reverse().join('') }} <...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'ng-model-compare-with', template: ` <mc-form-field> <mc-select [ngModel]="selectedFood" (ngModelChange)="setFoodByCopy($event)" [compareWith]="comparator"> <mc-option *ngFor="let food of foods" [value]="food">{{ food.viewValue }...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-select placeholder="Food" [formControl]="control" [errorStateMatcher]="errorStateMatcher"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> </mc-select> ` }) class CustomErrorBehavi...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <mc-select placeholder="Food" [(ngModel)]="selectedFoods"> <mc-option *ngFor="let food of foods" [value]="food.value">{{ food.viewValue }} </mc-option> </mc-select> </mc-form-...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ selector: 'select-without-option-centering', template: ` <mc-form-field> <mc-select placeholder="Food" [formControl]="control"> <mc-option *ngFor="let food of foods" [value]="food.value"> {{ food.viewValue }} </mc-option> ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ClassDeclaration
@Component({ template: ` <mc-form-field> <!--<mc-label>Select a thing</mc-label>--> <mc-select [placeholder]="placeholder"> <mc-option [value]="'thing'">A thing</mc-option> </mc-select> </mc-form-field> ` }) class SelectWithFormFieldLabel { ...
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.options$ = merge( of(OPTIONS), this.searchCtrl.valueChanges .pipe(map((value) => this.getFilteredOptions(value))) ); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
private getFilteredOptions(value): string[] { const searchFilter = (value && value.new) ? value.value : value; return searchFilter ? this.options.filter((option) => option.toLowerCase().includes((searchFilter.toLowerCase()))) : this.options; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
ngOnInit() { throw Error('Oh no!'); }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
useCompareByValue() { this.comparator = this.compareByValue; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
useCompareByReference() { this.comparator = this.compareByReference; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
useNullComparator() { this.comparator = null; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
compareByValue(f1: any, f2: any) { return f1 && f2 && f1.value === f2.value; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
compareByReference(f1: any, f2: any) { return f1 === f2; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
MethodDeclaration
setFoodByCopy(newValue: { value: string; viewValue: string }) { this.selectedFood = { ...{}, ...newValue }; }
anywie/mosaic
packages/mosaic/select/select.component.spec.ts
TypeScript
ArrowFunction
moderator => moderator.userId
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
ArrowFunction
moderator => moderator.partial && moderator.fetch()
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
ArrowFunction
(moderator: GuildMember) => { return `**${moderator.user.tag ?? moderator.id}**` }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
ArrowFunction
attachment => `- ${attachment.name ?? 'unknown'}: ${attachment.url}`
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
InterfaceDeclaration
export interface NewTicket extends Ticket { authorId: string typeId: number author: GuildMember type: TicketType }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
InterfaceDeclaration
export interface TicketUpdateOptions { channel?: TextChannelResolvable }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public setup (data: TicketEntity): void { this.id = data.id this.channelId = data.channelId this.guildId = data.guildId this.typeId = data.typeId ?? null this.authorId = data.author?.userId ?? null if (typeof data.moderators !== 'undefined') { this._moderators = data.moderators.map(moder...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async populateChannel (): Promise<void> { if (!this.isNew()) { return } const { robloxId, robloxUsername } = await this.fetchAuthorData() const date = new Date() const readableDate = getDate(date) const readableTime = getTime(date) const ticketInfoEmbed = new MessageEmbed() ...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async close (message: string, success: boolean, color?: number): Promise<void> { if (this.guild.ticketArchivesChannel !== null) { await this.guild.ticketArchivesChannel.send(await this.fetchArchiveAttachment()) } await this.channel.delete() if (this.author !== null) { const embed = ...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async requestRating (): Promise<string | null> { if (this.author === null) { return null } const embed = new MessageEmbed() .setColor(this.guild.primaryColor ?? applicationConfig.defaultColor) .setAuthor(this.client.user?.username, this.client.user?.displayAvatarURL()) .setT...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async logRating (rating: string): Promise<Message | null> { if (this.guild.ratingsChannel === null) { return null } await Promise.allSettled([ this.author?.partial === true && this.author.fetch(), ...this.moderators.cache.map(moderator => moderator.partial && moderator.fetch()) ...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async fetchArchiveAttachment (): Promise<MessageAttachment> { let output = '' output += 'TICKET INFORMATION\n' output += `ID: ${this.id}\nType: ${this.type?.name ?? 'deleted'}\n\n` if (this.author?.partial === true) { try { await this.author.fetch() } catch {} } con...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async fetchAuthorData (): Promise<{ robloxId: number | null, robloxUsername: string | null }> { let robloxId = null let robloxUsername = null try { robloxId = this.author?.robloxId ?? (await this.author?.fetchVerificationData())?.robloxId ?? null robloxUsername = this.author?.robloxUsern...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async fetchMessages (): Promise<Collection<string, Message>> { let result = new Collection<string, Message>() let after = '0' do { const messages = (await this.channel.messages.fetch({ after })).sort() result = result.concat(messages) after = messages.last()?.id ?? '' } while (...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async update (data: TicketUpdateOptions): Promise<Ticket> { return await this.guild.tickets.update(this, data) }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async delete (): Promise<void> { return await this.guild.tickets.delete(this) }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public async onMessage (message: Message): Promise<void> { if (message.member === null) { return } if (message.member.id === this.authorId) { if (this.timeout !== null) { this.client.clearTimeout(this.timeout) this.timeout = null } } else { if (!this.moderators.c...
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
MethodDeclaration
public isNew (): this is NewTicket { return this.author !== null && this.type !== null }
guidojw/arora-discord
src/structures/ticket.ts
TypeScript
FunctionDeclaration
export function createFormHelper<T extends {}>(): IFormHelper<T> { uidSeed += 1 const formUid = String(uidSeed) return { nameOf(key: keyof T) { return key as string }, idOf(id: keyof T) { return formUid + '_' + id }, } }
shopstic/react-rfp
src/forms.ts
TypeScript
FunctionDeclaration
export function extractFormData<T>(form: HTMLFormElement): T { const elements = form.elements const data: any = {} for (let i = 0; i < elements.length; i++) { const item = elements.item(i)! const name = item.getAttribute('name') if (name) { data[name] = (item as any).value } } return ...
shopstic/react-rfp
src/forms.ts
TypeScript