commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
3798faec825f0e91bed983078c4191a0d2f83563
src/tutorial/ClickablePre.tsx
src/tutorial/ClickablePre.tsx
import React from "react"; import { setInputCode } from "../Terminal/InputField"; export function ClickablePre({ children }: { children: any }) { return ( <pre className="clickable"> <code onClick={() => { setInputCode(children.props.children.replace(/\s*;.*\n/g, "")); }} > {children} </code> </pre> ); }
import React from "react"; import { setInputCode } from "../Terminal/InputField"; export function ClickablePre({ children }: { children: any }) { return ( <pre className="clickable"> <code onClick={() => { setInputCode( children.props.children .replace(/\s*;.*\n/g, "") .replace(/\s+/g, " "), ); }} > {children} </code> </pre> ); }
Remove whitespace from commands copied to terminal
Remove whitespace from commands copied to terminal
TypeScript
apache-2.0
calebegg/proof-pad,calebegg/proof-pad,calebegg/proof-pad,calebegg/proof-pad,calebegg/proof-pad
--- +++ @@ -6,7 +6,11 @@ <pre className="clickable"> <code onClick={() => { - setInputCode(children.props.children.replace(/\s*;.*\n/g, "")); + setInputCode( + children.props.children + .replace(/\s*;.*\n/g, "") + .replace(/\s+/g, " "), + ); }} > {children}
d4427654ef34a5ebe0383fff4604f65c6a9136d1
capstone-project/src/main/angular-webapp/src/app/authentication/authentication.component.ts
capstone-project/src/main/angular-webapp/src/app/authentication/authentication.component.ts
import { Component, OnInit } from '@angular/core'; import { SocialAuthService, GoogleLoginProvider, SocialUser } from "angularx-social-login"; import { UserService } from "../user.service"; @Component({ selector: 'app-authentication', templateUrl: './authentication.component.html', styleUrls: ['./authentication.component.css'] }) export class AuthenticationComponent implements OnInit { constructor(private authService: SocialAuthService, private userService: UserService) { } ngOnInit(): void { // When user status changes update the user service this.authService.authState.subscribe((user) => { this.userService.setUser(user); }); } // Sign in user signInWithGoogle(): void { this.authService.signIn(GoogleLoginProvider.PROVIDER_ID); } // Sign out user and reload page signOut(): void { this.authService.signOut(); AuthenticationComponent.reloadWindow(); } // Reloads the window static reloadWindow(): void { window.location.reload(); } // Return the current user get user(): SocialUser { return this.userService.getUser(); } // Return the userService getUserService() { return this.userService; } }
import { Component, OnInit } from '@angular/core'; import { SocialAuthService, GoogleLoginProvider, SocialUser } from "angularx-social-login"; import { UserService } from "../user.service"; @Component({ selector: 'app-authentication', templateUrl: './authentication.component.html', styleUrls: ['./authentication.component.css'] }) export class AuthenticationComponent implements OnInit { constructor(private authService: SocialAuthService, private userService: UserService) { } ngOnInit(): void { // When user status changes update the user service this.authService.authState.subscribe((user) => { this.userService.setUser(user); }); } // Sign in user signInWithGoogle(): void { this.authService.signIn(GoogleLoginProvider.PROVIDER_ID); } // Sign out user and reload page signOut(): void { this.authService.signOut(); AuthenticationComponent.reloadWindow(); } // Reloads the window static reloadWindow(): void { window.location.reload(); } // Return the current user get user(): SocialUser { return this.userService.getUser(); } }
Remove get user service method
Remove get user service method
TypeScript
apache-2.0
googleinterns/step263-2020,googleinterns/step263-2020,googleinterns/step263-2020,googleinterns/step263-2020
--- +++ @@ -38,9 +38,4 @@ get user(): SocialUser { return this.userService.getUser(); } - - // Return the userService - getUserService() { - return this.userService; - } }
66a00f1b72c2f82ebdbd2945698daaf0f8068b42
options/customers.ts
options/customers.ts
export interface CustomerSearchOptions { /** * Text to search for in the shop's customer data. */ query: string; /** * Set the field and direction by which to order results. */ order: string; }
export interface CustomerSearchOptions { /** * Text to search for in the shop's customer data. */ query?: string; /** * Set the field and direction by which to order results. */ order?: string; }
Make customer search options optional
Make customer search options optional
TypeScript
mit
nozzlegear/Shopify-Prime
--- +++ @@ -2,10 +2,10 @@ /** * Text to search for in the shop's customer data. */ - query: string; + query?: string; /** * Set the field and direction by which to order results. */ - order: string; + order?: string; }
171debaa57137401c400b46967cb281261ea1169
packages/components/containers/app/StandalonePublicApp.tsx
packages/components/containers/app/StandalonePublicApp.tsx
import React from 'react'; import { Route, Switch } from 'react-router-dom'; import { TtagLocaleMap } from 'proton-shared/lib/interfaces/Locale'; import StandardPublicApp from './StandardPublicApp'; import MinimalLoginContainer from '../login/MinimalLoginContainer'; import { OnLoginCallback } from './interface'; interface Props { onLogin: OnLoginCallback; locales: TtagLocaleMap; } const StandalonePublicApp = ({ onLogin, locales }: Props) => { return ( <StandardPublicApp locales={locales}> <Switch> <Route render={() => <MinimalLoginContainer onLogin={onLogin} />} /> </Switch> </StandardPublicApp> ); }; export default StandalonePublicApp;
import React from 'react'; import { TtagLocaleMap } from 'proton-shared/lib/interfaces/Locale'; import StandardPublicApp from './StandardPublicApp'; import MinimalLoginContainer from '../login/MinimalLoginContainer'; import { OnLoginCallback } from './interface'; interface Props { onLogin: OnLoginCallback; locales: TtagLocaleMap; } const StandalonePublicApp = ({ onLogin, locales }: Props) => { return ( <StandardPublicApp locales={locales}> <MinimalLoginContainer onLogin={onLogin} /> </StandardPublicApp> ); }; export default StandalonePublicApp;
Remove routes from standalone public app
Remove routes from standalone public app
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,5 +1,4 @@ import React from 'react'; -import { Route, Switch } from 'react-router-dom'; import { TtagLocaleMap } from 'proton-shared/lib/interfaces/Locale'; import StandardPublicApp from './StandardPublicApp'; import MinimalLoginContainer from '../login/MinimalLoginContainer'; @@ -12,9 +11,7 @@ const StandalonePublicApp = ({ onLogin, locales }: Props) => { return ( <StandardPublicApp locales={locales}> - <Switch> - <Route render={() => <MinimalLoginContainer onLogin={onLogin} />} /> - </Switch> + <MinimalLoginContainer onLogin={onLogin} /> </StandardPublicApp> ); };
9fcc6a7e9417011ce641d8790b4cd98bfc9176a6
src/actions/watcherFolders.ts
src/actions/watcherFolders.ts
import { WATCHER_FOLDER_EDIT, CREATE_WATCHER_FOLDER } from '../constants/index'; import { WatcherFolder } from '../types'; export interface EditWatcherFolder { readonly type: WATCHER_FOLDER_EDIT; readonly folderId: string; readonly field: 'name'; readonly value: string; } export interface CreateWatcherFolder { readonly type: CREATE_WATCHER_FOLDER; readonly payload: WatcherFolder; } export type WatcherFolderAction = CreateWatcherFolder | EditWatcherFolder; export const editWatcherFolder = ( folderId: string, field: 'name', value: string ): WatcherFolderAction => ({ type: WATCHER_FOLDER_EDIT, folderId, field, value }); export const createWatcherFolder = ( payload: WatcherFolder ): CreateWatcherFolder => ({ type: CREATE_WATCHER_FOLDER, payload });
import { WATCHER_FOLDER_EDIT, CREATE_WATCHER_FOLDER, DELETE_WATCHER_FOLDER } from '../constants/index'; import { WatcherFolder } from '../types'; export interface EditWatcherFolder { readonly type: WATCHER_FOLDER_EDIT; readonly folderId: string; readonly field: 'name'; readonly value: string; } export interface CreateWatcherFolder { readonly type: CREATE_WATCHER_FOLDER; readonly payload: WatcherFolder; } export interface DeleteWatcherFolder { readonly type: DELETE_WATCHER_FOLDER; readonly folderId: string; } export type WatcherFolderAction = | CreateWatcherFolder | DeleteWatcherFolder | EditWatcherFolder; export const editWatcherFolder = ( folderId: string, field: 'name', value: string ): WatcherFolderAction => ({ type: WATCHER_FOLDER_EDIT, folderId, field, value }); export const createWatcherFolder = ( payload: WatcherFolder ): CreateWatcherFolder => ({ type: CREATE_WATCHER_FOLDER, payload }); export const deleteWatcherFolder = (folderId: string): DeleteWatcherFolder => ({ type: DELETE_WATCHER_FOLDER, folderId });
Add action creators for DELETE_WATCHER_FOLDER.
Add action creators for DELETE_WATCHER_FOLDER.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -1,4 +1,8 @@ -import { WATCHER_FOLDER_EDIT, CREATE_WATCHER_FOLDER } from '../constants/index'; +import { + WATCHER_FOLDER_EDIT, + CREATE_WATCHER_FOLDER, + DELETE_WATCHER_FOLDER +} from '../constants/index'; import { WatcherFolder } from '../types'; export interface EditWatcherFolder { @@ -13,7 +17,15 @@ readonly payload: WatcherFolder; } -export type WatcherFolderAction = CreateWatcherFolder | EditWatcherFolder; +export interface DeleteWatcherFolder { + readonly type: DELETE_WATCHER_FOLDER; + readonly folderId: string; +} + +export type WatcherFolderAction = + | CreateWatcherFolder + | DeleteWatcherFolder + | EditWatcherFolder; export const editWatcherFolder = ( folderId: string, @@ -32,3 +44,8 @@ type: CREATE_WATCHER_FOLDER, payload }); + +export const deleteWatcherFolder = (folderId: string): DeleteWatcherFolder => ({ + type: DELETE_WATCHER_FOLDER, + folderId +});
cdf48fb04665eaac71dd90977c5d2a44317e1f86
app/javascript/services/behave.ts
app/javascript/services/behave.ts
type Selector = string | ((e: Element) => Array<Element>); function resolveElements(root: Element, selector: Selector): Array<Element> { if (typeof selector === 'string') { return Array.from(root.querySelectorAll(selector)); } else { return selector(root); } } class Behavior { constructor(private element: HTMLElement, private selector: Selector, private handler: (item: any) => any, private sequence: number) {} refresh() { resolveElements(this.element, this.selector).forEach((e) => { const key = `alreadyBound${this.sequence}`; if (!e[key]) { e[key] = true; this.handler.call(e); } }); } } const behaviors: Behavior[] = []; let sequence = 0; export function register(element: HTMLElement, selector: string, handler: (item: any) => any) { const b = new Behavior(element, selector, handler, sequence++); behaviors.push(b); b.refresh(); } export function refresh() { behaviors.forEach((b) => b.refresh()); }
type Selector = string | ((e: Element) => Array<Element>); function resolveElements(root: Element, selector: Selector): Array<Element> { if (typeof selector === 'string') { return Array.from(root.querySelectorAll(selector)); } else { return selector(root); } } class Behavior { constructor(private element: HTMLElement, private selector: Selector, private handler: (item: any) => any, private sequence: number) {} refresh() { resolveElements(this.element, this.selector).forEach((e) => { const elem = e as any; const key = `alreadyBound${this.sequence}`; if (!elem[key]) { elem[key] = true; this.handler.call(e); } }); } } const behaviors: Behavior[] = []; let sequence = 0; export function register(element: HTMLElement, selector: string, handler: (item: any) => any) { const b = new Behavior(element, selector, handler, sequence++); behaviors.push(b); b.refresh(); } export function refresh() { behaviors.forEach((b) => b.refresh()); }
Fix TS compilation that was not triggered in incremental compilation
Fix TS compilation that was not triggered in incremental compilation
TypeScript
agpl-3.0
ekylibre/ekylibre,ekylibre/ekylibre,ekylibre/ekylibre,ekylibre/ekylibre,ekylibre/ekylibre
--- +++ @@ -13,10 +13,11 @@ refresh() { resolveElements(this.element, this.selector).forEach((e) => { + const elem = e as any; const key = `alreadyBound${this.sequence}`; - if (!e[key]) { - e[key] = true; + if (!elem[key]) { + elem[key] = true; this.handler.call(e); } });
ae5598fc2315e9e14aa6bf8195677faca1ba86f2
src/app/app.component.spec.ts
src/app/app.component.spec.ts
/* tslint:disable:no-unused-variable */ import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; describe('App: D3Ng2Demo', () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], }); }); it('should create the app', async(() => { let fixture = TestBed.createComponent(AppComponent); let app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); it(`should have as title 'D3 Demo'`, async(() => { let fixture = TestBed.createComponent(AppComponent); let app = fixture.debugElement.componentInstance; expect(app.title).toEqual('Not D3 Demo'); })); // it('should render title in a h1 tag', async(() => { // let fixture = TestBed.createComponent(AppComponent); // fixture.detectChanges(); // let compiled = fixture.debugElement.nativeElement; // expect(compiled.querySelector('h1').textContent).toContain('app works!'); // })); });
/* tslint:disable:no-unused-variable */ import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; describe('App: D3Ng2Demo', () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], }); }); it('should create the app', async(() => { let fixture = TestBed.createComponent(AppComponent); let app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); it(`should have as title 'D3 Demo'`, async(() => { let fixture = TestBed.createComponent(AppComponent); let app = fixture.debugElement.componentInstance; expect(app.title).toEqual('D3 Demo'); })); // it('should render title in a h1 tag', async(() => { // let fixture = TestBed.createComponent(AppComponent); // fixture.detectChanges(); // let compiled = fixture.debugElement.nativeElement; // expect(compiled.querySelector('h1').textContent).toContain('app works!'); // })); });
Remove forced test error. * Changed the code that forced a Karma error to validate travis config. Travis failed as expected.
Remove forced test error. * Changed the code that forced a Karma error to validate travis config. Travis failed as expected.
TypeScript
mit
tomwanzek/d3-ng2-demo,tomwanzek/d3-ng2-demo,ardadurak/map_visualisation,ardadurak/map_visualisation,tomwanzek/d3-ng2-demo,ardadurak/map_visualisation
--- +++ @@ -21,7 +21,7 @@ it(`should have as title 'D3 Demo'`, async(() => { let fixture = TestBed.createComponent(AppComponent); let app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('Not D3 Demo'); + expect(app.title).toEqual('D3 Demo'); })); // it('should render title in a h1 tag', async(() => {
aa164beead2703786e211446e368cb239bee20f9
tests/cases/compiler/implicitAnyInCatch.ts
tests/cases/compiler/implicitAnyInCatch.ts
///<style implicitAny="off" /> try { } catch (error) { } // Shouldn't be an error for (var key in this) { } // Shouldn't be an error
//@disallowimplicitany: true try { } catch (error) { } // Shouldn't be an error for (var key in this) { } // Shouldn't be an error
Update specifying disallowimplicitany flag in the old test file.
Update specifying disallowimplicitany flag in the old test file.
TypeScript
apache-2.0
fdecampredon/jsx-typescript-old-version,popravich/typescript,popravich/typescript,hippich/typescript,mbrowne/typescript-dci,mbrowne/typescript-dci,hippich/typescript,fdecampredon/jsx-typescript-old-version,mbrowne/typescript-dci,hippich/typescript,mbebenita/shumway.ts,mbrowne/typescript-dci,popravich/typescript,mbebenita/shumway.ts,mbebenita/shumway.ts,fdecampredon/jsx-typescript-old-version
--- +++ @@ -1,3 +1,3 @@ -///<style implicitAny="off" /> +//@disallowimplicitany: true try { } catch (error) { } // Shouldn't be an error for (var key in this) { } // Shouldn't be an error
82e27fd2744bfebd479932978e4a0b3db3639714
src/Switch.webmodeler.ts
src/Switch.webmodeler.ts
import { Component, createElement } from "react"; import { Switch } from "./components/Switch"; import { SwitchContainerProps } from "./components/SwitchContainer"; import * as css from "./ui/Switch.sass"; // tslint:disable class-name export class preview extends Component<SwitchContainerProps, {}> { componentWillMount() { this.addPreviewStyle("widget-switch"); } render() { return createElement(Switch, { bootstrapStyle: this.props.bootstrapStyle, isChecked: true, onClick: undefined as any, status: this.props.editable === "default" ? "enabled" : "disabled" }); } private addPreviewStyle(styleId: string) { // This workaround is to load style in the preview temporary till mendix has a better solution const iFrame = document.getElementsByClassName("t-page-editor-iframe")[0] as HTMLIFrameElement; const iFrameDoc = iFrame.contentDocument; if (!iFrameDoc.getElementById(styleId)) { const styleTarget = iFrameDoc.head || iFrameDoc.getElementsByTagName("head")[0]; const styleElement = document.createElement("style"); styleElement.setAttribute("type", "text/css"); styleElement.setAttribute("id", styleId); styleElement.appendChild(document.createTextNode(css)); styleTarget.appendChild(styleElement); } } }
import { Component, createElement } from "react"; import { Switch } from "./components/Switch"; import { SwitchContainerProps } from "./components/SwitchContainer"; import * as css from "./ui/Switch.sass"; import { Label } from "./components/Label"; // tslint:disable class-name export class preview extends Component<SwitchContainerProps, {}> { componentWillMount() { this.addPreviewStyle("widget-switch"); } render() { const maxLabelWidth = 11; if (this.props.label.trim()) { return createElement(Label, { className: this.props.class, label: this.props.label, weight: this.props.labelWidth > maxLabelWidth ? maxLabelWidth : this.props.labelWidth }, this.renderSwitch()); } return this.renderSwitch(); } private renderSwitch() { return createElement(Switch, { bootstrapStyle: this.props.bootstrapStyle, isChecked: true, onClick: undefined as any, status: this.props.editable === "default" ? "enabled" : "disabled" }); } private addPreviewStyle(styleId: string) { // This workaround is to load style in the preview temporary till mendix has a better solution const iFrame = document.getElementsByClassName("t-page-editor-iframe")[0] as HTMLIFrameElement; const iFrameDoc = iFrame.contentDocument; if (!iFrameDoc.getElementById(styleId)) { const styleTarget = iFrameDoc.head || iFrameDoc.getElementsByTagName("head")[0]; const styleElement = document.createElement("style"); styleElement.setAttribute("type", "text/css"); styleElement.setAttribute("id", styleId); styleElement.appendChild(document.createTextNode(css)); styleTarget.appendChild(styleElement); } } }
Add support for the label
Add support for the label
TypeScript
apache-2.0
FlockOfBirds/boolean-slider,FlockOfBirds/boolean-slider
--- +++ @@ -3,6 +3,7 @@ import { SwitchContainerProps } from "./components/SwitchContainer"; import * as css from "./ui/Switch.sass"; +import { Label } from "./components/Label"; // tslint:disable class-name export class preview extends Component<SwitchContainerProps, {}> { @@ -11,6 +12,19 @@ } render() { + const maxLabelWidth = 11; + if (this.props.label.trim()) { + return createElement(Label, { + className: this.props.class, + label: this.props.label, + weight: this.props.labelWidth > maxLabelWidth ? maxLabelWidth : this.props.labelWidth + }, this.renderSwitch()); + } + + return this.renderSwitch(); + } + + private renderSwitch() { return createElement(Switch, { bootstrapStyle: this.props.bootstrapStyle, isChecked: true,
950ae711e2b38f0e5439e0d69f1f7803d23031ed
config.service.ts
config.service.ts
export class HsConfig { constructor(){} }
export class HsConfig { componentsEnabled: any; mapInteractionsEnabled: boolean; allowAddExternalDatasets: boolean; sidebarClosed: boolean; constructor() { } }
Add properties used in HsCore to HsConfig type def
Add properties used in HsCore to HsConfig type def
TypeScript
mit
hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng
--- +++ @@ -1,3 +1,9 @@ export class HsConfig { - constructor(){} + componentsEnabled: any; + mapInteractionsEnabled: boolean; + allowAddExternalDatasets: boolean; + sidebarClosed: boolean; + constructor() { + + } }
a6daa370ec92bbec5217e4f7d03951a66ac6b9fd
frontend/applications/auth/src/modules/register/NotApproved.tsx
frontend/applications/auth/src/modules/register/NotApproved.tsx
import React from 'react'; import { css } from 'react-emotion'; export const NotApproved = () => ( <div className={css` padding: 2rem; `}> <h1>Come back later!</h1> <p>Thanks for registering!</p> <p> You have completed registration but you're not able to log in just yet. A program manager will have to review and approve your account. You will receive an email once your account has been approved. </p> </div> );
import React from 'react'; import { css } from 'react-emotion'; import { logout } from '../common/services/login'; export const NotApproved = () => ( <div className={css` padding: 2rem; `}> <h1>Come back later!</h1> <p>Thanks for registering!</p> <p> If you have already verified your email address, please contact your program manager so that they can approve you. </p> <p> You have completed registration but you're not able to log in just yet. A program manager will have to review and approve your account. You will receive an email once your account has been approved. </p> <a href="#" onClick={logout}> Back to login </a> </div> );
Add logout button & prompt to login again
Add logout button & prompt to login again
TypeScript
mit
CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift
--- +++ @@ -1,5 +1,6 @@ import React from 'react'; import { css } from 'react-emotion'; +import { logout } from '../common/services/login'; export const NotApproved = () => ( <div @@ -9,8 +10,14 @@ <h1>Come back later!</h1> <p>Thanks for registering!</p> <p> + If you have already verified your email address, please contact your program manager so that they can approve you. + </p> + <p> You have completed registration but you're not able to log in just yet. A program manager will have to review and approve your account. You will receive an email once your account has been approved. </p> + <a href="#" onClick={logout}> + Back to login + </a> </div> );
5f27c645b990725e1eeba0313d2871858171415a
packages/shared/lib/i18n/helper.ts
packages/shared/lib/i18n/helper.ts
import { DEFAULT_LOCALE } from '../constants'; import { TtagLocaleMap } from '../interfaces/Locale'; /** * Gets the first specified locale from the browser, if any. */ export const getBrowserLocale = () => { return window.navigator.languages && window.navigator.languages.length ? window.navigator.languages[0] : undefined; }; export const getNormalizedLocale = (locale = '') => { return locale.toLowerCase().replace('-', '_'); }; /** * Get the closest matching locale from an object of locales. */ export const getClosestLocaleMatch = (locale = '', locales = {}) => { const localeKeys = [DEFAULT_LOCALE, ...Object.keys(locales)].sort(); const normalizedLocale = getNormalizedLocale(locale); // First by language and country code. const fullMatch = localeKeys.find((key) => getNormalizedLocale(key) === normalizedLocale); if (fullMatch) { return fullMatch; } // Language code. const language = normalizedLocale.substr(0, 2); const languageMatch = localeKeys.find((key) => key.substr(0, 2).toLowerCase() === language); if (languageMatch) { return languageMatch; } }; export const getClosestLocaleCode = (locale: string | undefined, locales: TtagLocaleMap) => { if (!locale) { return DEFAULT_LOCALE; } return getClosestLocaleMatch(locale, locales) || DEFAULT_LOCALE; };
import { DEFAULT_LOCALE } from '../constants'; /** * Gets the first specified locale from the browser, if any. */ export const getBrowserLocale = () => { return window.navigator.languages && window.navigator.languages.length ? window.navigator.languages[0] : undefined; }; export const getNormalizedLocale = (locale = '') => { return locale.toLowerCase().replace('-', '_'); }; /** * Get the closest matching locale from an object of locales. */ export const getClosestLocaleMatch = (locale = '', locales = {}) => { const localeKeys = [DEFAULT_LOCALE, ...Object.keys(locales)].sort(); const normalizedLocale = getNormalizedLocale(locale); // First by language and country code. const fullMatch = localeKeys.find((key) => getNormalizedLocale(key) === normalizedLocale); if (fullMatch) { return fullMatch; } // Language code. const language = normalizedLocale.substr(0, 2); const languageMatch = localeKeys.find((key) => key.substr(0, 2).toLowerCase() === language); if (languageMatch) { return languageMatch; } }; export const getClosestLocaleCode = (locale: string | undefined, locales: { [key: string]: any }) => { if (!locale) { return DEFAULT_LOCALE; } return getClosestLocaleMatch(locale, locales) || DEFAULT_LOCALE; };
Allow any in locale map
Allow any in locale map
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,5 +1,4 @@ import { DEFAULT_LOCALE } from '../constants'; -import { TtagLocaleMap } from '../interfaces/Locale'; /** * Gets the first specified locale from the browser, if any. @@ -33,7 +32,7 @@ } }; -export const getClosestLocaleCode = (locale: string | undefined, locales: TtagLocaleMap) => { +export const getClosestLocaleCode = (locale: string | undefined, locales: { [key: string]: any }) => { if (!locale) { return DEFAULT_LOCALE; }
efc98c4bd9054b8876a87715ce876a0e8a55a331
app/src/ui/preferences/advanced.tsx
app/src/ui/preferences/advanced.tsx
import * as React from 'react' import { User } from '../../models/user' import { DialogContent } from '../dialog' interface IAdvancedPreferencesProps { readonly user: User | null } interface IAdvancedPreferencesState { readonly reportingOptOut: boolean, } export class Advanced extends React.Component<IAdvancedPreferencesProps, IAdvancedPreferencesState> { public constructor(props: IAdvancedPreferencesProps) { super(props) this.state = { reportingOptOut: false, } } private toggle = () => { const optOut = this.state.reportingOptOut if (optOut) { return this.setState({ reportingOptOut: false, }) } return this.setState({ reportingOptOut: true, }) } public render() { return ( <DialogContent> <label>Opt-out of usage reporting</label> <input type='checkbox' checked={this.state.reportingOptOut} onChange={this.toggle} /> </DialogContent> ) } }
import * as React from 'react' import { Dispatcher } from '../../lib/dispatcher' import { DialogContent } from '../dialog' import { Checkbox, CheckboxValue } from '../lib/checkbox' interface IAdvancedPreferencesProps { readonly dispatcher: Dispatcher } interface IAdvancedPreferencesState { readonly reportingOptOut: boolean, } export class Advanced extends React.Component<IAdvancedPreferencesProps, IAdvancedPreferencesState> { public constructor(props: IAdvancedPreferencesProps) { super(props) this.state = { reportingOptOut: false, } } public componentDidMount() { const optOut = this.props.dispatcher.getStatsOptOut() this.setState({ reportingOptOut: optOut, }) } private onChange = (event: React.FormEvent<HTMLInputElement>) => { const value = event.currentTarget.checked this.props.dispatcher.setStatsOptOut(!value) this.setState({ reportingOptOut: !value, }) } public render() { return ( <DialogContent> <Checkbox label='Opt-out of usage reporting' value={this.state.reportingOptOut ? CheckboxValue.Off : CheckboxValue.On} onChange={this.onChange} /> </DialogContent> ) } }
Reimplement component using the checkbox component
Reimplement component using the checkbox component
TypeScript
mit
j-f1/forked-desktop,BugTesterTest/desktops,artivilla/desktop,shiftkey/desktop,desktop/desktop,BugTesterTest/desktops,BugTesterTest/desktops,artivilla/desktop,kactus-io/kactus,hjobrien/desktop,desktop/desktop,kactus-io/kactus,kactus-io/kactus,say25/desktop,say25/desktop,shiftkey/desktop,say25/desktop,hjobrien/desktop,BugTesterTest/desktops,gengjiawen/desktop,artivilla/desktop,j-f1/forked-desktop,j-f1/forked-desktop,hjobrien/desktop,shiftkey/desktop,say25/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,gengjiawen/desktop,desktop/desktop,artivilla/desktop,gengjiawen/desktop,hjobrien/desktop,gengjiawen/desktop,kactus-io/kactus
--- +++ @@ -1,9 +1,10 @@ import * as React from 'react' -import { User } from '../../models/user' +import { Dispatcher } from '../../lib/dispatcher' import { DialogContent } from '../dialog' +import { Checkbox, CheckboxValue } from '../lib/checkbox' interface IAdvancedPreferencesProps { - readonly user: User | null + readonly dispatcher: Dispatcher } interface IAdvancedPreferencesState { @@ -19,28 +20,31 @@ } } - private toggle = () => { - const optOut = this.state.reportingOptOut + public componentDidMount() { + const optOut = this.props.dispatcher.getStatsOptOut() - if (optOut) { - return this.setState({ - reportingOptOut: false, - }) - } + this.setState({ + reportingOptOut: optOut, + }) + } - return this.setState({ - reportingOptOut: true, + private onChange = (event: React.FormEvent<HTMLInputElement>) => { + const value = event.currentTarget.checked + + this.props.dispatcher.setStatsOptOut(!value) + + this.setState({ + reportingOptOut: !value, }) } public render() { return ( <DialogContent> - <label>Opt-out of usage reporting</label> - <input - type='checkbox' - checked={this.state.reportingOptOut} - onChange={this.toggle} /> + <Checkbox + label='Opt-out of usage reporting' + value={this.state.reportingOptOut ? CheckboxValue.Off : CheckboxValue.On} + onChange={this.onChange} /> </DialogContent> ) }
f40e1ff0cc793e60ae72bdc430c24e372cd86015
src/server/web/url-preview.ts
src/server/web/url-preview.ts
import * as Koa from 'koa'; import summaly from 'summaly'; module.exports = async (ctx: Koa.Context) => { const summary = await summaly(ctx.query.url); summary.icon = wrap(summary.icon); summary.thumbnail = wrap(summary.thumbnail); // Cache 7days ctx.set('Cache-Control', 'max-age=604800, immutable'); ctx.body = summary; }; function wrap(url: string): string { return url != null ? url.startsWith('https://') ? url : `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}` : null; }
import * as Koa from 'koa'; import summaly from 'summaly'; module.exports = async (ctx: Koa.Context) => { const summary = await summaly(ctx.query.url); summary.icon = wrap(summary.icon); summary.thumbnail = wrap(summary.thumbnail); // Cache 7days ctx.set('Cache-Control', 'max-age=604800, immutable'); ctx.body = summary; }; function wrap(url: string): string { return url != null ? url.startsWith('https://') || url.startsWith('data:') ? url : `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}` : null; }
Fix cause error in case preview has data URI
Fix cause error in case preview has data URI
TypeScript
mit
syuilo/Misskey,syuilo/Misskey,Tosuke/misskey,ha-dai/Misskey,Tosuke/misskey,ha-dai/Misskey,Tosuke/misskey,Tosuke/misskey,Tosuke/misskey
--- +++ @@ -14,7 +14,7 @@ function wrap(url: string): string { return url != null - ? url.startsWith('https://') + ? url.startsWith('https://') || url.startsWith('data:') ? url : `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}` : null;
b04edae16d6ff5fe7c256467513282ee01c94c4a
src/Diploms.WebUI/ClientApp/app/components/sign-in/sign-in.component.ts
src/Diploms.WebUI/ClientApp/app/components/sign-in/sign-in.component.ts
import { Component } from '@angular/core'; import { AlertService } from '../../shared/alert/services/alert.service'; @Component({ selector: 'sign-in', templateUrl: './sign-in.component.html', }) export class SignInComponent { constructor(private alertService: AlertService) { } model:any={}; login(){ this.alertService.error("Неверный логин или пароль"); } }
import { Component } from '@angular/core'; import { AlertService } from '../../shared/alert/services/alert.service'; import { AuthRequest, AuthService } from '../../auth/services/auth.service'; import { Router } from '@angular/router'; @Component({ selector: 'sign-in', templateUrl: './sign-in.component.html', }) export class SignInComponent { constructor(private authService:AuthService, private router: Router ,private alertService: AlertService) { } model= { login: "", password:"", remember:true }; login(){ const authRequest: AuthRequest = { userName: this.model.login, password: this.model.password, rememberMe: this.model.remember }; this.authService.login(authRequest).subscribe(_=>{ this.router.navigate(['/']); }, error=>this.alertService.error("Неверный логин или пароль")); } }
Modify Login Component to call API and authenticate
Modify Login Component to call API and authenticate
TypeScript
mit
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
--- +++ @@ -1,15 +1,26 @@ import { Component } from '@angular/core'; import { AlertService } from '../../shared/alert/services/alert.service'; +import { AuthRequest, AuthService } from '../../auth/services/auth.service'; +import { Router } from '@angular/router'; @Component({ selector: 'sign-in', templateUrl: './sign-in.component.html', }) export class SignInComponent { - constructor(private alertService: AlertService) { } + constructor(private authService:AuthService, private router: Router ,private alertService: AlertService) { } - model:any={}; + model= { + login: "", password:"", remember:true + }; login(){ - this.alertService.error("Неверный логин или пароль"); + const authRequest: AuthRequest = { + userName: this.model.login, + password: this.model.password, + rememberMe: this.model.remember + }; + this.authService.login(authRequest).subscribe(_=>{ + this.router.navigate(['/']); + }, error=>this.alertService.error("Неверный логин или пароль")); } }
748d079a88ee824530895a2cb5c477dc5e9af4d3
lib/settings/DefaultSettings.ts
lib/settings/DefaultSettings.ts
import {VoidHook} from "../tasks/Hooks"; export default { projectType: "frontend", port: 5000, liveReloadPort: 35729, distribution: "dist", targets: "targets", bootstrapperStyles: "", watchStyles: [ "styles" ], test: "test/**/*.ts", images: "images", assets: "assets", autoprefixer: ["last 2 versions", "> 1%"], scripts: "scripts/**/*.{ts,tsx}", revisionExclude: [], nodemon: {}, uglifyjs: {}, preBuild: VoidHook, postBuild: VoidHook }
import {VoidHook} from "../tasks/Hooks"; export default { projectType: "frontend", port: 5000, liveReloadPort: 35729, distribution: "dist", targets: "targets", bootstrapperStyles: "", watchStyles: [ "styles" ], test: "test/**/*.ts", images: "images", assets: "assets", autoprefixer: ["last 2 versions", "> 1%"], scripts: "scripts/**/*.{ts,tsx}", revisionExclude: [], nodemon: {}, uglifyjs: { output: { "ascii_only": true } }, preBuild: VoidHook, postBuild: VoidHook }
Change uglify default settings to fix minify UTF-8 characters problems
Change uglify default settings to fix minify UTF-8 characters problems
TypeScript
mit
mtfranchetto/smild,mtfranchetto/smild,mtfranchetto/smild
--- +++ @@ -17,7 +17,11 @@ scripts: "scripts/**/*.{ts,tsx}", revisionExclude: [], nodemon: {}, - uglifyjs: {}, + uglifyjs: { + output: { + "ascii_only": true + } + }, preBuild: VoidHook, postBuild: VoidHook }
444267870d01712bb34f4795ecf9bc8f377066ae
front_end/src/app/admin/sign-in/sign-in.service.spec.ts
front_end/src/app/admin/sign-in/sign-in.service.spec.ts
/* tslint:disable:no-unused-variable */ import { TestBed, async, inject } from '@angular/core/testing'; import { SignInService } from './sign-in.service'; import { HttpClientService } from '../../shared/services/http-client.service'; import { Http, RequestOptions, Headers, Response, ResponseOptions } from '@angular/http'; import { MockConnection, MockBackend } from '@angular/http/testing'; import {CookieService, CookieOptions} from 'angular2-cookie/core'; describe('SignInService', () => { let fixture: SignInService; let httpClientService: HttpClientService; let http: Http; let options: RequestOptions; let backend: MockBackend; let responseObject: any; let cookie: CookieService; let body: any; beforeEach(() => { TestBed.configureTestingModule({ declarations: [ HttpClientService ], }); backend = new MockBackend(); options = new RequestOptions(); options.headers = new Headers(); http = new Http(backend, options); cookie = new CookieService(new CookieOptions()); httpClientService = new HttpClientService(http, cookie); fixture = new SignInService(httpClientService); body = { email: '[email protected]', password: 'password123' }; }); describe('logIn', () => { let requestHeaders: Headers; let requestUrl: string; beforeEach(() => { backend.connections.subscribe((connection: MockConnection) => { requestHeaders = connection.request.headers; requestUrl = connection.request.url; connection.mockRespond(new Response(new ResponseOptions({ body: responseObject }))); }); }); afterEach(() => { backend.resolveAllConnections(); backend.verifyNoPendingRequests(); httpClientService.logOut(); }); it('should successfully login a user', () => { responseObject = { userToken: 'userToken1', refreshToken: 'refreshToken1', roles: ['123', '456'] }; let response = http.post( `${process.env.ECHECK_API_ENDPOINT}/authenticate`, body); let login = fixture.logIn(body.email, body.password); options.headers.set('Authorization', 'successful'); response.subscribe((res: Response) => { expect(res.json()).toEqual(responseObject); expect(requestHeaders).toBeDefined(); expect(httpClientService.isLoggedIn()).toBeTruthy(); }); }); it('should not login a user', () => { responseObject = { userToken: undefined }; let response = http.post( `${process.env.ECHECK_API_ENDPOINT}/authenticate`, body); let login = fixture.logIn(body.email, body.password); options.headers.set('Authorization', 'successful'); response.subscribe((res: Response) => { expect(res.json()).toEqual(responseObject); expect(requestHeaders).toBeDefined(); expect(httpClientService.isLoggedIn()).toBeFalsy(); }); }); }); });
Add test for sign-in service
Add test for sign-in service
TypeScript
bsd-2-clause
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
--- +++ @@ -0,0 +1,82 @@ +/* tslint:disable:no-unused-variable */ + +import { TestBed, async, inject } from '@angular/core/testing'; +import { SignInService } from './sign-in.service'; +import { HttpClientService } from '../../shared/services/http-client.service'; +import { Http, RequestOptions, Headers, Response, ResponseOptions } from '@angular/http'; +import { MockConnection, MockBackend } from '@angular/http/testing'; +import {CookieService, CookieOptions} from 'angular2-cookie/core'; + +describe('SignInService', () => { + let fixture: SignInService; + let httpClientService: HttpClientService; + let http: Http; + let options: RequestOptions; + let backend: MockBackend; + let responseObject: any; + let cookie: CookieService; + let body: any; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ + HttpClientService + ], + }); + backend = new MockBackend(); + options = new RequestOptions(); + options.headers = new Headers(); + http = new Http(backend, options); + cookie = new CookieService(new CookieOptions()); + httpClientService = new HttpClientService(http, cookie); + fixture = new SignInService(httpClientService); + body = { email: '[email protected]', password: 'password123' }; + }); + + describe('logIn', () => { + let requestHeaders: Headers; + let requestUrl: string; + + beforeEach(() => { + backend.connections.subscribe((connection: MockConnection) => { + requestHeaders = connection.request.headers; + requestUrl = connection.request.url; + connection.mockRespond(new Response(new ResponseOptions({ + body: responseObject + }))); + }); + }); + + afterEach(() => { + backend.resolveAllConnections(); + backend.verifyNoPendingRequests(); + httpClientService.logOut(); + }); + + it('should successfully login a user', () => { + responseObject = { userToken: 'userToken1', refreshToken: 'refreshToken1', roles: ['123', '456'] }; + let response = http.post( `${process.env.ECHECK_API_ENDPOINT}/authenticate`, body); + let login = fixture.logIn(body.email, body.password); + options.headers.set('Authorization', 'successful'); + + response.subscribe((res: Response) => { + expect(res.json()).toEqual(responseObject); + expect(requestHeaders).toBeDefined(); + expect(httpClientService.isLoggedIn()).toBeTruthy(); + }); + }); + + it('should not login a user', () => { + responseObject = { userToken: undefined }; + let response = http.post( `${process.env.ECHECK_API_ENDPOINT}/authenticate`, body); + let login = fixture.logIn(body.email, body.password); + options.headers.set('Authorization', 'successful'); + + response.subscribe((res: Response) => { + expect(res.json()).toEqual(responseObject); + expect(requestHeaders).toBeDefined(); + expect(httpClientService.isLoggedIn()).toBeFalsy(); + }); + }); + }); +});
a5007fb1e7f5c146251d5ceb55957fda50b72954
src/column/StringColumn.ts
src/column/StringColumn.ts
/** * Created by Samuel Gratzl on 19.01.2017. */ import {AVectorColumn, IStringVector} from './AVectorColumn'; import {EOrientation} from './AColumn'; import {mixin} from 'phovea_core/src/index'; import {IMultiFormOptions} from 'phovea_core/src/multiform'; export default class StringColumn extends AVectorColumn<string, IStringVector> { minimumWidth: number = 80; preferredWidth: number = 300; constructor(data: IStringVector, orientation: EOrientation, parent: HTMLElement) { super(data, orientation); this.$node = this.build(parent); } protected multiFormParams($body: d3.Selection<any>): IMultiFormOptions { return mixin(super.multiFormParams($body), { initialVis: 'list' }); } }
/** * Created by Samuel Gratzl on 19.01.2017. */ import {AVectorColumn, IStringVector} from './AVectorColumn'; import {EOrientation} from './AColumn'; import {mixin} from 'phovea_core/src/index'; import {IMultiFormOptions} from 'phovea_core/src/multiform'; export default class StringColumn extends AVectorColumn<string, IStringVector> { minimumWidth: number = 80; preferredWidth: number = 300; constructor(data: IStringVector, orientation: EOrientation, parent: HTMLElement) { super(data, orientation); this.$node = this.build(parent); } protected multiFormParams($body: d3.Selection<any>): IMultiFormOptions { return mixin(super.multiFormParams($body), { initialVis: 'list', 'list': { cssClass: 'taggle-list' } }); } }
Add cssClass option to string list vis
Add cssClass option to string list vis
TypeScript
bsd-3-clause
Caleydo/mothertable,Caleydo/mothertable,Caleydo/mothertable
--- +++ @@ -18,7 +18,10 @@ protected multiFormParams($body: d3.Selection<any>): IMultiFormOptions { return mixin(super.multiFormParams($body), { - initialVis: 'list' + initialVis: 'list', + 'list': { + cssClass: 'taggle-list' + } }); }
9f6940b764a76819d7dfb628840f0aaa97120040
src/rooms/IRoom.ts
src/rooms/IRoom.ts
import { IUser } from '../users'; import { RoomType } from './RoomType'; export interface IRoom { id: string; name: string; type: RoomType; creator: IUser; usernames: Array<string>; isDefault?: boolean; messageCount?: number; createdAt?: Date; updatedAt?: Date; lastModifiedAt?: Date; }
import { IUser } from '../users'; import { RoomType } from './RoomType'; export interface IRoom { id: string; displayName: string; slugifiedName?: string; type: RoomType; creator: IUser; usernames: Array<string>; isDefault?: boolean; isReadOnly?: boolean; displaySystemMessages?: boolean; messageCount?: number; createdAt?: Date; updatedAt?: Date; lastModifiedAt?: Date; customFields?: { [key: string]: object }; }
Add some properties to the room interface
Add some properties to the room interface
TypeScript
mit
graywolf336/temporary-rocketlets-ts-definition,graywolf336/temporary-rocketlets-ts-definition
--- +++ @@ -3,13 +3,17 @@ export interface IRoom { id: string; - name: string; + displayName: string; + slugifiedName?: string; type: RoomType; creator: IUser; usernames: Array<string>; isDefault?: boolean; + isReadOnly?: boolean; + displaySystemMessages?: boolean; messageCount?: number; createdAt?: Date; updatedAt?: Date; lastModifiedAt?: Date; + customFields?: { [key: string]: object }; }
946deec8d28aef5509387ec10fe2b65e21862b32
src/app/page-not-found/page-not-found.component.ts
src/app/page-not-found/page-not-found.component.ts
import { Router } from '@angular/router'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-page-not-found', templateUrl: './page-not-found.component.html', }) export class PageNotFoundComponent implements OnInit { constructor(public router: Router) { } ngOnInit() { } }
import { Router } from '@angular/router'; import { Component, OnInit } from '@angular/core'; import { ActionIcon, ActionIconService } from '../actionitem.service'; @Component({ selector: 'app-page-not-found', templateUrl: './page-not-found.component.html', }) export class PageNotFoundComponent implements OnInit { constructor(public router: Router, private actionItemService: ActionIconService) { } ngOnInit() { this.actionItemService.addActionIcon({title: "Go back", icon: "arrow_back", onClickListener: ()=> { window.history.back(); }, showAsAction: true}); }; }
Add home icon to not found page
chore: Add home icon to not found page
TypeScript
mit
Chan4077/angular-rss-reader,Chan4077/angular-rss-reader,Chan4077/angular-rss-reader
--- +++ @@ -1,5 +1,6 @@ import { Router } from '@angular/router'; import { Component, OnInit } from '@angular/core'; +import { ActionIcon, ActionIconService } from '../actionitem.service'; @Component({ selector: 'app-page-not-found', @@ -7,9 +8,12 @@ }) export class PageNotFoundComponent implements OnInit { - constructor(public router: Router) { } + constructor(public router: Router, private actionItemService: ActionIconService) { } ngOnInit() { - } + this.actionItemService.addActionIcon({title: "Go back", icon: "arrow_back", onClickListener: ()=> { + window.history.back(); + }, showAsAction: true}); + }; }
514967660f23e5a6bd4f87477b5dafdc1d612abf
geopattern/geopattern-tests.ts
geopattern/geopattern-tests.ts
/// <reference path="index.d.ts" /> /// <reference path="../jquery/index.d.ts" /> var pattern = GeoPattern.generate('GitHub'); pattern.toDataUrl(); $('#geopattern').geopattern('GitHub');
/// <reference path="index.d.ts" /> /// <reference types="jquery" /> var pattern = GeoPattern.generate('GitHub'); pattern.toDataUrl(); $('#geopattern').geopattern('GitHub');
Switch to <reference types /> in tests.
[geopattern] Switch to <reference types /> in tests.
TypeScript
mit
scriby/DefinitelyTyped,YousefED/DefinitelyTyped,arusakov/DefinitelyTyped,AgentME/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,rolandzwaga/DefinitelyTyped,YousefED/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,georgemarshall/DefinitelyTyped,abbasmhd/DefinitelyTyped,georgemarshall/DefinitelyTyped,mcrawshaw/DefinitelyTyped,arusakov/DefinitelyTyped,psnider/DefinitelyTyped,micurs/DefinitelyTyped,AgentME/DefinitelyTyped,nycdotnet/DefinitelyTyped,use-strict/DefinitelyTyped,magny/DefinitelyTyped,benliddicott/DefinitelyTyped,mcrawshaw/DefinitelyTyped,georgemarshall/DefinitelyTyped,psnider/DefinitelyTyped,AgentME/DefinitelyTyped,alexdresko/DefinitelyTyped,isman-usoh/DefinitelyTyped,alvarorahul/DefinitelyTyped,psnider/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,chrismbarr/DefinitelyTyped,sledorze/DefinitelyTyped,johan-gorter/DefinitelyTyped,arusakov/DefinitelyTyped,AgentME/DefinitelyTyped,zuzusik/DefinitelyTyped,amir-arad/DefinitelyTyped,use-strict/DefinitelyTyped,jimthedev/DefinitelyTyped,chrootsu/DefinitelyTyped,johan-gorter/DefinitelyTyped,benishouga/DefinitelyTyped,dsebastien/DefinitelyTyped,QuatroCode/DefinitelyTyped,isman-usoh/DefinitelyTyped,shlomiassaf/DefinitelyTyped,QuatroCode/DefinitelyTyped,ashwinr/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,one-pieces/DefinitelyTyped,martinduparc/DefinitelyTyped,aciccarello/DefinitelyTyped,abbasmhd/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,rolandzwaga/DefinitelyTyped,martinduparc/DefinitelyTyped,chrootsu/DefinitelyTyped,magny/DefinitelyTyped,sledorze/DefinitelyTyped,smrq/DefinitelyTyped,borisyankov/DefinitelyTyped,smrq/DefinitelyTyped,minodisk/DefinitelyTyped,jimthedev/DefinitelyTyped,georgemarshall/DefinitelyTyped,nycdotnet/DefinitelyTyped,ashwinr/DefinitelyTyped,mcliment/DefinitelyTyped,benishouga/DefinitelyTyped,alexdresko/DefinitelyTyped,aciccarello/DefinitelyTyped,aciccarello/DefinitelyTyped,markogresak/DefinitelyTyped,borisyankov/DefinitelyTyped,zuzusik/DefinitelyTyped,dsebastien/DefinitelyTyped,martinduparc/DefinitelyTyped,progre/DefinitelyTyped,shlomiassaf/DefinitelyTyped,jimthedev/DefinitelyTyped,alvarorahul/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,scriby/DefinitelyTyped,benishouga/DefinitelyTyped,minodisk/DefinitelyTyped,chrismbarr/DefinitelyTyped,progre/DefinitelyTyped,zuzusik/DefinitelyTyped
--- +++ @@ -1,5 +1,5 @@ /// <reference path="index.d.ts" /> -/// <reference path="../jquery/index.d.ts" /> +/// <reference types="jquery" /> var pattern = GeoPattern.generate('GitHub'); pattern.toDataUrl();
897ec5a3797b1d07dcccd4da13b06a2fdc064b90
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.1', RELEASEVERSION: '0.15.1' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.16.0', RELEASEVERSION: '0.16.0' }; export = BaseConfig;
Update release version to 0.16.0.
Update release version to 0.16.0.
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.1', - RELEASEVERSION: '0.15.1' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.16.0', + RELEASEVERSION: '0.16.0' }; export = BaseConfig;
04c4b432669d3fe2ee8f6b9304cea1a766417972
react/javascript/test/search/FilteringTest.ts
react/javascript/test/search/FilteringTest.ts
import assert from 'assert' import { messages, IdGenerator } from '@cucumber/messages' import Search from '../../src/search/Search' import { makeFeature, makeScenario, makeStep } from './utils' import Parser from '@cucumber/gherkin/dist/src/Parser' import AstBuilder from '@cucumber/gherkin/dist/src/AstBuilder' import pretty from '../../src/pretty-formatter/pretty' describe('Search', () => { let search: Search let gherkinDocuments: messages.IGherkinDocument[] beforeEach(() => { const source = `Feature: Continents Scenario: Europe Given France When Spain Then The Netherlands Scenario: America Given Mexico Then Brazil ` const newId = IdGenerator.uuid() const parser = new Parser(new AstBuilder(newId)) const gherkinDocument = parser.parse(source) search = new Search() search.add(gherkinDocument) }) context('Hit found in step', () => { it('displays just one scenario', () => { const searchResults = search.search('Spain') assert.deepStrictEqual(pretty(searchResults[0]), `Feature: Continents Scenario: Europe Given France When Spain Then The Netherlands `) }) }) })
import assert from 'assert' import { messages, IdGenerator } from '@cucumber/messages' import Search from '../../src/search/Search' import { makeFeature, makeScenario, makeStep } from './utils' import Parser from '@cucumber/gherkin/dist/src/Parser' import AstBuilder from '@cucumber/gherkin/dist/src/AstBuilder' import pretty from '../../src/pretty-formatter/pretty' describe('Search', () => { let search: Search const source = `Feature: Continents Background: World Given the world exists Scenario: Europe Given France When Spain Then The Netherlands Scenario: America Given Mexico Then Brazil ` beforeEach(() => { const newId = IdGenerator.uuid() const parser = new Parser(new AstBuilder(newId)) const gherkinDocument = parser.parse(source) search = new Search() search.add(gherkinDocument) }) context('Hit found in step', () => { it('displays just one scenario', () => { const searchResults = search.search('Spain') assert.deepStrictEqual(pretty(searchResults[0]), `Feature: Continents Background: World Given the world exists Scenario: Europe Given France When Spain Then The Netherlands `) }) }) context('Hit found in scenario', () => { it('displays just one scenario', () => { const searchResults = search.search('europe') assert.deepStrictEqual(pretty(searchResults[0]), `Feature: Continents Background: World Given the world exists Scenario: Europe Given France When Spain Then The Netherlands `) }) }) context('Hit found in background', () => { it('displays all scenarios', () => { const searchResults = search.search('world') assert.deepStrictEqual(pretty(searchResults[0]), source) }) }) })
Add background failing example of filtering
Add background failing example of filtering
TypeScript
mit
cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber
--- +++ @@ -8,10 +8,10 @@ describe('Search', () => { let search: Search - let gherkinDocuments: messages.IGherkinDocument[] + const source = `Feature: Continents - beforeEach(() => { - const source = `Feature: Continents + Background: World + Given the world exists Scenario: Europe Given France @@ -23,6 +23,7 @@ Then Brazil ` + beforeEach(() => { const newId = IdGenerator.uuid() const parser = new Parser(new AstBuilder(newId)) const gherkinDocument = parser.parse(source) @@ -37,6 +38,9 @@ assert.deepStrictEqual(pretty(searchResults[0]), `Feature: Continents + Background: World + Given the world exists + Scenario: Europe Given France When Spain @@ -44,6 +48,31 @@ `) }) }) + + context('Hit found in scenario', () => { + it('displays just one scenario', () => { + const searchResults = search.search('europe') + + assert.deepStrictEqual(pretty(searchResults[0]), `Feature: Continents + + Background: World + Given the world exists + + Scenario: Europe + Given France + When Spain + Then The Netherlands +`) + }) + }) + + context('Hit found in background', () => { + it('displays all scenarios', () => { + const searchResults = search.search('world') + + assert.deepStrictEqual(pretty(searchResults[0]), source) + }) + }) })
cbab3e575fa2e58ef1d12b3c9b524e8e59ec87d8
test/index.ts
test/index.ts
import * as path from 'path'; import * as Mocha from 'mocha'; import * as glob from 'glob'; export function run(): Promise<void> { // Create the mocha test const mocha = new Mocha({ ui: 'tdd' }); mocha.useColors(true); const testsRoot = path.resolve(__dirname, '..'); return new Promise((c, e) => { glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { return e(err); } // Add files to the test suite files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); try { // Run the mocha test mocha.run(failures => { if (failures > 0) { e(new Error(`${failures} tests failed.`)); } else { c(); } }); } catch (err) { console.error(err); e(err); } }); }); }
import * as path from 'path'; import * as Mocha from 'mocha'; import * as glob from 'glob'; export function run(): Promise<void> { // Create the mocha test const mocha = new Mocha({ ui: 'tdd' }); mocha.useColors(true); mocha.timeout(5000); const testsRoot = path.resolve(__dirname, '..'); return new Promise((c, e) => { glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { return e(err); } // Add files to the test suite files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); try { // Run the mocha test mocha.run(failures => { if (failures > 0) { e(new Error(`${failures} tests failed.`)); } else { c(); } }); } catch (err) { console.error(err); e(err); } }); }); }
Increase test timeout (first one was failing)
Increase test timeout (first one was failing)
TypeScript
mit
ipatalas/vscode-postfix-ts,ipatalas/vscode-postfix-ts
--- +++ @@ -8,6 +8,7 @@ ui: 'tdd' }); mocha.useColors(true); + mocha.timeout(5000); const testsRoot = path.resolve(__dirname, '..');
fbfc00ab194b77a10182c61316e8a62de1118ff7
src/panels/panel-view.styles.ts
src/panels/panel-view.styles.ts
import {css} from '@microsoft/fast-element'; import {display} from '@microsoft/fast-foundation'; import { density, designUnit, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens'; export const PanelViewStyles = css` ${display('flex')} :host { color: #ffffff; background-color: transparent; border: solid 1px transparent; box-sizing: border-box; font-size: ${typeRampBaseFontSize}; line-height: ${typeRampBaseLineHeight}; padding: 10px calc((6 + (${designUnit} * 2 * ${density})) * 1px); } `;
import {css} from '@microsoft/fast-element'; import {display} from '@microsoft/fast-foundation'; import { designUnit, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens'; export const PanelViewStyles = css` ${display('flex')} :host { color: #ffffff; background-color: transparent; border: solid 1px transparent; box-sizing: border-box; font-size: ${typeRampBaseFontSize}; line-height: ${typeRampBaseLineHeight}; padding: 10px calc((6 + (${designUnit}) * 1px); } `;
Remove density reference from panel view
Remove density reference from panel view
TypeScript
mit
microsoft/vscode-webview-ui-toolkit,microsoft/vscode-webview-ui-toolkit,microsoft/vscode-webview-ui-toolkit
--- +++ @@ -1,7 +1,6 @@ import {css} from '@microsoft/fast-element'; import {display} from '@microsoft/fast-foundation'; import { - density, designUnit, typeRampBaseFontSize, typeRampBaseLineHeight, @@ -15,6 +14,6 @@ box-sizing: border-box; font-size: ${typeRampBaseFontSize}; line-height: ${typeRampBaseLineHeight}; - padding: 10px calc((6 + (${designUnit} * 2 * ${density})) * 1px); + padding: 10px calc((6 + (${designUnit}) * 1px); } `;
a3acfb6cbad2da0a11b8cad55617aaffe58d53a9
app/src/ui/changes/undo-commit.tsx
app/src/ui/changes/undo-commit.tsx
import * as React from 'react' import { Commit } from '../../models/commit' import { RichText } from '../lib/rich-text' import { RelativeTime } from '../relative-time' import { Button } from '../lib/button' interface IUndoCommitProps { /** The function to call when the Undo button is clicked. */ readonly onUndo: () => void /** The commit to undo. */ readonly commit: Commit /** The emoji cache to use when rendering the commit message */ readonly emoji: Map<string, string> /** whether a push, pull or fetch is in progress */ readonly isPushPullFetchInProgress: boolean } /** The Undo Commit component. */ export class UndoCommit extends React.Component<IUndoCommitProps, void> { public render() { const disabled = this.props.isPushPullFetchInProgress const title = disabled ? 'Undo is disabled while the repository is being updated' : undefined const authorDate = this.props.commit.author.date return ( <div id='undo-commit'> <div className='commit-info'> <div className='ago'>Committed <RelativeTime date={authorDate} /></div> <RichText emoji={this.props.emoji} className='summary' text={this.props.commit.summary} /> </div> <div className='actions' title={title}> <Button size='small' disabled={disabled} onClick={this.props.onUndo}>Undo</Button> </div> </div> ) } }
import * as React from 'react' import { Commit } from '../../models/commit' import { RichText } from '../lib/rich-text' import { RelativeTime } from '../relative-time' import { Button } from '../lib/button' interface IUndoCommitProps { /** The function to call when the Undo button is clicked. */ readonly onUndo: () => void /** The commit to undo. */ readonly commit: Commit /** The emoji cache to use when rendering the commit message */ readonly emoji: Map<string, string> /** whether a push, pull or fetch is in progress */ readonly isPushPullFetchInProgress: boolean } /** The Undo Commit component. */ export class UndoCommit extends React.Component<IUndoCommitProps, void> { public render() { const disabled = this.props.isPushPullFetchInProgress const title = disabled ? 'Undo is disabled while the repository is being updated' : undefined const authorDate = this.props.commit.author.date return ( <div id='undo-commit'> <div className='commit-info'> <div className='ago'>Committed <RelativeTime date={authorDate} /></div> <RichText emoji={this.props.emoji} className='summary' text={this.props.commit.summary} renderUrlsAsLinks={false} /> </div> <div className='actions' title={title}> <Button size='small' disabled={disabled} onClick={this.props.onUndo}>Undo</Button> </div> </div> ) } }
Disable URL becomming links in undo
Disable URL becomming links in undo Follow comment on #1605
TypeScript
mit
j-f1/forked-desktop,hjobrien/desktop,gengjiawen/desktop,desktop/desktop,j-f1/forked-desktop,desktop/desktop,kactus-io/kactus,say25/desktop,gengjiawen/desktop,gengjiawen/desktop,gengjiawen/desktop,BugTesterTest/desktops,kactus-io/kactus,artivilla/desktop,shiftkey/desktop,artivilla/desktop,say25/desktop,j-f1/forked-desktop,BugTesterTest/desktops,shiftkey/desktop,hjobrien/desktop,hjobrien/desktop,say25/desktop,hjobrien/desktop,kactus-io/kactus,BugTesterTest/desktops,artivilla/desktop,BugTesterTest/desktops,desktop/desktop,desktop/desktop,shiftkey/desktop,j-f1/forked-desktop,artivilla/desktop,kactus-io/kactus,say25/desktop,shiftkey/desktop
--- +++ @@ -33,7 +33,8 @@ <RichText emoji={this.props.emoji} className='summary' - text={this.props.commit.summary} /> + text={this.props.commit.summary} + renderUrlsAsLinks={false} /> </div> <div className='actions' title={title}> <Button size='small' disabled={disabled} onClick={this.props.onUndo}>Undo</Button>
f4b17c5ccfc9bbc22d853adc321c568d7cd7fb15
functions/src/tracks-view/generate-tracks.ts
functions/src/tracks-view/generate-tracks.ts
import { Request, Response } from 'express' import { FirebaseApp } from '../firebase' import { firestoreRawCollection } from '../firestore/collection' import { TrackData } from '../firestore/data' import { Track } from './tracks-view-data' export const generateTracks = (firebaseApp: FirebaseApp) => (_: Request, response: Response) => { const firestore = firebaseApp.firestore() const rawCollection = firestoreRawCollection(firebaseApp) const tracksPromise = rawCollection<TrackData>('tracks') tracksPromise.then(tracks => { const tracksCollection = firestore.collection('views') .doc('tracks_view') .collection('tracks') return Promise.all(tracks.map(trackData => { const event: Track = { accentColor: trackData.accent_color, iconUrl: trackData.icon_url, id: trackData.id, name: trackData.name, textColor: trackData.text_color } return tracksCollection.doc(event.id).set(event) })) }).then(() => { response.status(200).send('Yay!') }).catch(error => { console.error(error) response.status(500).send('Nay.') }) }
import { Request, Response } from 'express' import { FirebaseApp } from '../firebase' import { firestoreRawCollection } from '../firestore/collection' import { TrackData } from '../firestore/data' import { Track } from './tracks-view-data' export const generateTracks = (firebaseApp: FirebaseApp) => (_: Request, response: Response) => { const firestore = firebaseApp.firestore() const rawCollection = firestoreRawCollection(firebaseApp) const tracksPromise = rawCollection<TrackData>('tracks') tracksPromise.then(tracks => { const tracksCollection = firestore.collection('views') .doc('tracks') .collection('tracks') return Promise.all(tracks.map(trackData => { const event: Track = { accentColor: trackData.accent_color, iconUrl: trackData.icon_url, id: trackData.id, name: trackData.name, textColor: trackData.text_color } return tracksCollection.doc(event.id).set(event) })) }).then(() => { response.status(200).send('Yay!') }).catch(error => { console.error(error) response.status(500).send('Nay.') }) }
Rename the tracks_view document to track for consistency
Rename the tracks_view document to track for consistency
TypeScript
apache-2.0
squanchy-dev/squanchy-firebase,squanchy-dev/squanchy-firebase
--- +++ @@ -12,7 +12,7 @@ tracksPromise.then(tracks => { const tracksCollection = firestore.collection('views') - .doc('tracks_view') + .doc('tracks') .collection('tracks') return Promise.all(tracks.map(trackData => {
694beab534d215f7d5c5dbd65abc4598d495c216
packages/satelite/src/rete/nodes/ReteNode.ts
packages/satelite/src/rete/nodes/ReteNode.ts
import { IList } from "../util"; export interface IReteNode { type: | "join" | "production" | "root-join" | "root" | "query" | "negative" | "accumulator"; children: IList<IReteNode>; parent: IReteNode | null; } export abstract class ReteNode { type: string; children: IList<IReteNode>; parent: IReteNode | null; } export interface IRootNode extends IReteNode { type: "root"; parent: null; } export class RootNode extends ReteNode { static create() { return new RootNode(); } type = "root"; parent = null; } export function makeRootNode(): IRootNode { const node: IRootNode = Object.create(null); node.type = "root"; node.parent = null; return node; }
import { IList } from "../util"; export interface IReteNode { type: | "join" | "production" | "root-join" | "root" | "query" | "negative" | "accumulator"; children: IList<IReteNode>; parent: IReteNode | null; } export abstract class ReteNode { type: string; children: IList<IReteNode>; parent: IReteNode | null; } export class RootNode extends ReteNode { static create() { return new RootNode(); } type = "root"; parent = null; }
Remove old root node code
Remove old root node code
TypeScript
apache-2.0
tdreyno/satelite,tdreyno/satelite
--- +++ @@ -19,11 +19,6 @@ parent: IReteNode | null; } -export interface IRootNode extends IReteNode { - type: "root"; - parent: null; -} - export class RootNode extends ReteNode { static create() { return new RootNode(); @@ -32,12 +27,3 @@ type = "root"; parent = null; } - -export function makeRootNode(): IRootNode { - const node: IRootNode = Object.create(null); - - node.type = "root"; - node.parent = null; - - return node; -}
22f2ca89704a9740c30d6a96007489b2b9f7ce02
src/debug/debug_entry.ts
src/debug/debug_entry.ts
import { DebugSession } from "vscode-debugadapter"; import { DartDebugSession } from "./dart_debug_impl"; import { DartTestDebugSession } from "./dart_test_debug_impl"; import { FlutterDebugSession } from "./flutter_debug_impl"; import { FlutterTestDebugSession } from "./flutter_test_debug_impl"; import { WebDebugSession } from "./web_debug_impl"; import { WebTestDebugSession } from "./web_test_debug_impl"; const args = process.argv.slice(2); const debugType = args.length ? args[0] : undefined; const debuggers: { [key: string]: any } = { "dart": DartDebugSession, "dart_test": DartTestDebugSession, "flutter": FlutterDebugSession, "flutter_test": FlutterTestDebugSession, "web": WebDebugSession, "web_test": WebTestDebugSession, }; const dbg = debugType ? debuggers[debugType] : undefined; if (dbg) { DebugSession.run(dbg); } else { throw new Error(`Debugger type must be one of ${Object.keys(debuggers).join(", ")} but got ${debugType}`); }
import { DebugSession } from "vscode-debugadapter"; import { DartDebugSession } from "./dart_debug_impl"; import { DartTestDebugSession } from "./dart_test_debug_impl"; import { FlutterDebugSession } from "./flutter_debug_impl"; import { FlutterTestDebugSession } from "./flutter_test_debug_impl"; import { WebDebugSession } from "./web_debug_impl"; import { WebTestDebugSession } from "./web_test_debug_impl"; const args = process.argv.slice(2); const debugType = args.length ? args[0] : undefined; const debuggers: { [key: string]: any } = { "dart": DartDebugSession, "dart_test": DartTestDebugSession, "flutter": FlutterDebugSession, "flutter_test": FlutterTestDebugSession, "web": WebDebugSession, "web_test": WebTestDebugSession, }; const dbg = debugType ? debuggers[debugType] : undefined; if (dbg) { DebugSession.run(dbg); } else { throw new Error(`Debugger type must be one of ${Object.keys(debuggers).join(", ")} but got ${debugType}.\n argv: ${process.argv.join(" ")}`); }
Include argv in debug adapter error message
Include argv in debug adapter error message See https://github.com/Dart-Code/Dart-Code/issues/2782.
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -22,5 +22,5 @@ if (dbg) { DebugSession.run(dbg); } else { - throw new Error(`Debugger type must be one of ${Object.keys(debuggers).join(", ")} but got ${debugType}`); + throw new Error(`Debugger type must be one of ${Object.keys(debuggers).join(", ")} but got ${debugType}.\n argv: ${process.argv.join(" ")}`); }
571b6778aef578af5741596e81bf46932b085701
angular/src/app/file/file.ts
angular/src/app/file/file.ts
import { ITag } from '../tag'; export interface IFile { id: number; path: string; tags: ITag[]; }
import { ITag } from '../tag'; export interface IFile { id: number; path: string; webpath: string; tags: ITag[]; }
Add missing webpath property on IFile
Add missing webpath property on IFile
TypeScript
mit
waxe/waxe-image,waxe/waxe-image,waxe/waxe-image,waxe/waxe-image,waxe/waxe-image
--- +++ @@ -4,5 +4,6 @@ export interface IFile { id: number; path: string; + webpath: string; tags: ITag[]; }
251bafc19a415c4d8731b57dea77765cddb1fd3e
src/services/intl-api.ts
src/services/intl-api.ts
/** * Provides the methods to check if Intl APIs are supported. */ export class IntlAPI { public static hasIntl(): boolean { const hasIntl: boolean = Intl && typeof Intl === "object"; return hasIntl; } public static hasDateTimeFormat(): boolean { return IntlAPI.hasIntl && Intl​.hasOwnProperty​("DateTimeFormat"); } public static hasTimezone(): boolean { try { new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles' }).format(new Date()); } catch (e) { return false; } return true; } public static hasNumberFormat(): boolean { return IntlAPI.hasIntl && Intl.hasOwnProperty​("NumberFormat"); } public static hasCollator(): boolean { return IntlAPI.hasIntl && Intl.hasOwnProperty​("Collator"); } }
/** * Provides the methods to check if Intl APIs are supported. */ export class IntlAPI { public static hasIntl(): boolean { const hasIntl: boolean = typeof Intl === "object" && Intl; return hasIntl; } public static hasDateTimeFormat(): boolean { return IntlAPI.hasIntl && Intl​.hasOwnProperty​("DateTimeFormat"); } public static hasTimezone(): boolean { try { new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles' }).format(new Date()); } catch (e) { return false; } return true; } public static hasNumberFormat(): boolean { return IntlAPI.hasIntl && Intl.hasOwnProperty​("NumberFormat"); } public static hasCollator(): boolean { return IntlAPI.hasIntl && Intl.hasOwnProperty​("Collator"); } }
Fix Can't find variable: Intl for iOS/Safari
Fix Can't find variable: Intl for iOS/Safari On iOS device got thrown "Can't find variable: Intl". http://imgur.com/a/Q5vIC
TypeScript
mit
robisim74/angular-l10n,robisim74/angular-l10n,robisim74/angular-l10n,robisim74/angular2localization,robisim74/angular-l10n,robisim74/angular2localization
--- +++ @@ -4,7 +4,7 @@ export class IntlAPI { public static hasIntl(): boolean { - const hasIntl: boolean = Intl && typeof Intl === "object"; + const hasIntl: boolean = typeof Intl === "object" && Intl; return hasIntl; }
30b155a78e59161b83b87f2faf9bf970f169c6ea
types/ember__string/index.d.ts
types/ember__string/index.d.ts
// Type definitions for @ember/string 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Fstring, https://github.com/emberjs/ember-string // Definitions by: Mike North <https://github.com/mike-north> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { SafeString } from 'handlebars'; export function camelize(str: string): string; export function capitalize(str: string): string; export function classify(str: string): string; export function dasherize(str: string): string; export function decamelize(str: string): string; export function htmlSafe(str: string): SafeString; export function isHTMLSafe(str: any): str is SafeString; export function loc(template: string, args?: string[]): string; export function underscore(str: string): string; export function w(str: string): string[];
// Type definitions for non-npm package @ember/string 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Fstring // Definitions by: Mike North <https://github.com/mike-north> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { SafeString } from 'handlebars'; export function camelize(str: string): string; export function capitalize(str: string): string; export function classify(str: string): string; export function dasherize(str: string): string; export function decamelize(str: string): string; export function htmlSafe(str: string): SafeString; export function isHTMLSafe(str: any): str is SafeString; export function loc(template: string, args?: string[]): string; export function underscore(str: string): string; export function w(str: string): string[];
Make @ember/string a non-npm package
Make @ember/string a non-npm package And revert the unrelated project url.
TypeScript
mit
dsebastien/DefinitelyTyped,markogresak/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,mcliment/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped
--- +++ @@ -1,5 +1,5 @@ -// Type definitions for @ember/string 3.0 -// Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Fstring, https://github.com/emberjs/ember-string +// Type definitions for non-npm package @ember/string 3.0 +// Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Fstring // Definitions by: Mike North <https://github.com/mike-north> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8
ba708f1311e8c694b672b8964ab61a65e0e658ca
src/client/a1/model/player/player.effects.ts
src/client/a1/model/player/player.effects.ts
import { Injectable } from '@angular/core'; import { Actions, Effect } from '@ngrx/effects'; import { Grid } from '../../main/grid/grid.model'; import { Note } from '../../../common/core/note.model'; import { PlayerActions } from './player.actions'; import { SoundService } from "../../../common/sound/sound.service"; import { StageService } from '../stage/stage.service'; import { TransportService } from '../../../common/core/transport.service'; import { ticks } from '../../../common/core/beat-tick.model'; @Injectable() export class PlayerEffects { constructor( private actions$: Actions, private transport: TransportService, private stage: StageService, private sound: SoundService ) {} @Effect() play$ = this.actions$ .ofType(PlayerActions.SET) .map(action => action.payload) .filter(([surface]) => surface) .do(([surface, key, cursor, pulses]) => { let sound, beat, tick; if (surface instanceof Grid) { let pulse; [beat, pulse] = surface.beatPulseFor(cursor); sound = surface.soundByKey[key]; pulses = pulses[beat]; tick = ticks(pulse, pulses); } if (this.transport.canLivePlay(beat, cursor, pulses)) { this.stage.play(new Note(sound), beat, tick); } else if (!this.stage.isGoal) { this.sound.play(sound); } }).ignoreElements(); }
import { Injectable } from '@angular/core'; import { Actions, Effect } from '@ngrx/effects'; import { Grid } from '../../main/grid/grid.model'; import { Note } from '../../../common/core/note.model'; import { PlayerActions } from './player.actions'; import { SoundService } from "../../../common/sound/sound.service"; import { StageService } from '../stage/stage.service'; import { TransportService } from '../../../common/core/transport.service'; import { ticks } from '../../../common/core/beat-tick.model'; @Injectable() export class PlayerEffects { constructor( private actions$: Actions, private transport: TransportService, private stage: StageService, private sound: SoundService ) {} @Effect() play$ = this.actions$ .ofType(PlayerActions.SET) .map(action => action.payload) .filter(([surface]) => surface) .do(([surface, key, cursor, pulses]) => { let sound, beat, tick; if (surface instanceof Grid) { let pulse; [beat, pulse] = surface.beatPulseFor(cursor); sound = surface.soundByKey[key]; pulses = pulses[beat]; tick = ticks(pulse, pulses); } if (this.transport.canLivePlay(beat, cursor, pulses)) { this.stage.play(new Note(sound), beat, tick); } else if (this.stage.isStandby) { this.sound.play(sound); } }).ignoreElements(); }
Fix live sounds playing during playback when not the right time.
Fix live sounds playing during playback when not the right time.
TypeScript
mit
FlatThirteen/flat-thirteen,FlatThirteen/flat-thirteen,FlatThirteen/flat-thirteen
--- +++ @@ -34,7 +34,7 @@ } if (this.transport.canLivePlay(beat, cursor, pulses)) { this.stage.play(new Note(sound), beat, tick); - } else if (!this.stage.isGoal) { + } else if (this.stage.isStandby) { this.sound.play(sound); } }).ignoreElements();
8cbcb912814b545e162171b0639bfc87be8f2444
src/collection/TrickCard.ts
src/collection/TrickCard.ts
import { CardType as Type } from '@karuta/sanguosha-core'; import Card from '../driver/Card'; class TrickCard extends Card { getType(): Type { return Type.Trick; } } export default TrickCard;
import { CardType as Type } from '@karuta/sanguosha-core'; import Card from '../driver/Card'; import GameDriver from '../driver/GameDriver'; import CardUseStruct from '../driver/CardUseStruct'; class TrickCard extends Card { getType(): Type { return Type.Trick; } async use(driver: GameDriver, use: CardUseStruct): Promise<void> { const { card } = use; if (!card.isReal()) { return; } const handArea = use.from.getHandArea(); const processArea = use.from.getProcessArea(); driver.moveCards([card], handArea, processArea, { open: true }); } async complete(driver: GameDriver, use: CardUseStruct): Promise<void> { const { card } = use; if (!card.isReal()) { return; } const processArea = use.from.getProcessArea(); const discardPile = driver.getDiscardPile(); driver.moveCards([use.card], processArea, discardPile, { open: true }); } } export default TrickCard;
Add basic procedure of trick cards
Add basic procedure of trick cards
TypeScript
agpl-3.0
takashiro/sanguosha-server,takashiro/sanguosha-server
--- +++ @@ -1,11 +1,35 @@ import { CardType as Type } from '@karuta/sanguosha-core'; import Card from '../driver/Card'; +import GameDriver from '../driver/GameDriver'; +import CardUseStruct from '../driver/CardUseStruct'; class TrickCard extends Card { getType(): Type { return Type.Trick; } + + async use(driver: GameDriver, use: CardUseStruct): Promise<void> { + const { card } = use; + if (!card.isReal()) { + return; + } + + const handArea = use.from.getHandArea(); + const processArea = use.from.getProcessArea(); + driver.moveCards([card], handArea, processArea, { open: true }); + } + + async complete(driver: GameDriver, use: CardUseStruct): Promise<void> { + const { card } = use; + if (!card.isReal()) { + return; + } + + const processArea = use.from.getProcessArea(); + const discardPile = driver.getDiscardPile(); + driver.moveCards([use.card], processArea, discardPile, { open: true }); + } } export default TrickCard;
2880a37c0abd7fe77c853097b3155c2226dcfb57
src/common/events/PingEvent.ts
src/common/events/PingEvent.ts
import TEBEvent from '../../framework/common/event/TEBEvent'; export default class PingEvent extends TEBEvent<{msg: string, delay: number}> { static type = 'PingEvent'; type = PingEvent.type; }
import TEBEvent from '../../framework/common/event/TEBEvent'; export default class PingEvent extends TEBEvent<{user: string, msg: string, delay: number}> { static type = 'PingEvent'; type = PingEvent.type; }
Add return info for pong
Add return info for pong
TypeScript
mit
olegsmetanin/typescript_babel_react_express,olegsmetanin/typescript_babel_react_express
--- +++ @@ -1,6 +1,6 @@ import TEBEvent from '../../framework/common/event/TEBEvent'; -export default class PingEvent extends TEBEvent<{msg: string, delay: number}> { +export default class PingEvent extends TEBEvent<{user: string, msg: string, delay: number}> { static type = 'PingEvent'; type = PingEvent.type; }
2ebaf82a51169d44b4ae0ff4e2480e7b0b2b9f9f
test/fast/config-test.ts
test/fast/config-test.ts
import * as chai from 'chai' const expect = chai.expect import { GitProcess } from '../../lib' import * as os from 'os' describe('config', () => { it('sets http.sslBackend on Windows', async () => { if (process.platform === 'win32') { const result = await GitProcess.exec(['config', '--system', 'http.sslBackend'], os.homedir()) expect(result.stdout.trim()).to.equal('schannel') } }) })
import * as chai from 'chai' const expect = chai.expect import { GitProcess } from '../../lib' import * as os from 'os' describe('config', () => { it('sets http.sslBackend on Windows', async () => { if (process.platform === 'win32') { const result = await GitProcess.exec(['config', '--system', 'http.sslBackend'], os.homedir()) expect(result.stdout.trim()).to.equal('schannel') } }) it('unsets http.sslCAInfo on Windows', async () => { if (process.platform === 'win32') { const result = await GitProcess.exec(['config', '--system', 'http.sslCAInfo'], os.homedir()) expect(result.stdout.trim()).to.equal('') } }) })
Add test to ensure sslCAInfo is unset
Add test to ensure sslCAInfo is unset
TypeScript
mit
desktop/dugite,desktop/dugite,desktop/dugite
--- +++ @@ -11,4 +11,11 @@ expect(result.stdout.trim()).to.equal('schannel') } }) + + it('unsets http.sslCAInfo on Windows', async () => { + if (process.platform === 'win32') { + const result = await GitProcess.exec(['config', '--system', 'http.sslCAInfo'], os.homedir()) + expect(result.stdout.trim()).to.equal('') + } + }) })
5cca20305a0771b7d4ce58cedfb78d6ef506290c
src/statusBar/controller.ts
src/statusBar/controller.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Disposable, window, workspace } from "vscode"; import { FileAccess } from "./../constants"; import { Container } from "./../container"; import { StatusBar } from "./statusBar"; export class Controller { private statusBar: StatusBar; private disposable: Disposable; constructor() { this.statusBar = new StatusBar(); this.statusBar.update(); Container.context.subscriptions.push(this.statusBar); window.onDidChangeActiveTextEditor(() => { this.statusBar.update(); }, null, Container.context.subscriptions); workspace.onDidChangeConfiguration(cfg => { if (cfg.affectsConfiguration("fileAccess.position")) { this.statusBar.dispose(); this.statusBar = undefined; this.statusBar = new StatusBar(); } if (cfg.affectsConfiguration("fileAccess")) { this.updateStatusBar(); } }, null, Container.context.subscriptions); } public dispose() { this.disposable.dispose(); } public updateStatusBar(fileAccess?: FileAccess) { this.statusBar.update(fileAccess); } }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Alessandro Fragnani. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Disposable, window, workspace } from "vscode"; import { FileAccess } from "./../constants"; import { Container } from "./../container"; import { StatusBar } from "./statusBar"; export class Controller { private statusBar: StatusBar; private disposable: Disposable; constructor() { this.statusBar = new StatusBar(); this.statusBar.update(); Container.context.subscriptions.push(this.statusBar); window.onDidChangeActiveTextEditor(() => { this.statusBar.update(); }, null, Container.context.subscriptions); workspace.onDidChangeConfiguration(cfg => { if (cfg.affectsConfiguration("fileAccess.position")) { this.statusBar.dispose(); this.statusBar = undefined; this.statusBar = new StatusBar(); } if (cfg.affectsConfiguration("fileAccess")) { this.updateStatusBar(); } }, null, Container.context.subscriptions); workspace.onDidGrantWorkspaceTrust(() => { this.statusBar.dispose(); this.statusBar = undefined; this.statusBar = new StatusBar(); }) } public dispose() { this.disposable.dispose(); } public updateStatusBar(fileAccess?: FileAccess) { this.statusBar.update(fileAccess); } }
Add detection of workspace trust grant to update status bar
Add detection of workspace trust grant to update status bar
TypeScript
mit
alefragnani/vscode-read-only-indicator,alefragnani/vscode-read-only-indicator
--- +++ @@ -33,6 +33,13 @@ this.updateStatusBar(); } }, null, Container.context.subscriptions); + + workspace.onDidGrantWorkspaceTrust(() => { + this.statusBar.dispose(); + this.statusBar = undefined; + + this.statusBar = new StatusBar(); + }) } public dispose() {
49abb3186eebe50b16003998c71ea8440c66bc88
packages/lesswrong/components/sunshineDashboard/SidebarHoverOver.tsx
packages/lesswrong/components/sunshineDashboard/SidebarHoverOver.tsx
import React from 'react'; import { registerComponent } from '../../lib/vulcan-lib'; import Popper from '@material-ui/core/Popper'; const styles = (theme: ThemeType): JssStyles => ({ root: { position:"relative", zIndex: theme.zIndexes.sidebarHoverOver, }, hoverInfo: { position: "relative", backgroundColor: theme.palette.grey[50], padding: theme.spacing.unit*2, border: "solid 1px rgba(0,0,0,.1)", boxShadow: "-3px 0 5px 0px rgba(0,0,0,.1)", overflow: "hidden", } }) const SidebarHoverOver = ({children, classes, hover, anchorEl, width=500}: { children: React.ReactNode, classes: ClassesType, hover: boolean, anchorEl: HTMLElement|null, width?: number, }) => { return <Popper className={classes.root} open={hover} anchorEl={anchorEl} placement="left-start"> <div className={classes.hoverInfo} style={{width:width}}> { children } </div> </Popper> }; const SidebarHoverOverComponent = registerComponent('SidebarHoverOver', SidebarHoverOver, {styles}); declare global { interface ComponentTypes { SidebarHoverOver: typeof SidebarHoverOverComponent } }
import React from 'react'; import { Components, registerComponent } from '../../lib/vulcan-lib'; const styles = (theme: ThemeType): JssStyles => ({ root: { position:"relative", zIndex: theme.zIndexes.sidebarHoverOver, }, hoverInfo: { position: "relative", backgroundColor: theme.palette.grey[50], padding: theme.spacing.unit*2, border: "solid 1px rgba(0,0,0,.1)", boxShadow: "-3px 0 5px 0px rgba(0,0,0,.1)", overflow: "hidden", } }) const SidebarHoverOver = ({children, classes, hover, anchorEl, width=500}: { children: React.ReactNode, classes: ClassesType, hover: boolean, anchorEl: HTMLElement|null, width?: number, }) => { const { LWPopper } = Components; return <LWPopper className={classes.root} open={hover} anchorEl={anchorEl} placement="left-start"> <div className={classes.hoverInfo} style={{width:width}}> { children } </div> </LWPopper> }; const SidebarHoverOverComponent = registerComponent('SidebarHoverOver', SidebarHoverOver, {styles}); declare global { interface ComponentTypes { SidebarHoverOver: typeof SidebarHoverOverComponent } }
Fix blurry text in Sunshine Sidebar hover-overs
Fix blurry text in Sunshine Sidebar hover-overs
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -1,6 +1,5 @@ import React from 'react'; -import { registerComponent } from '../../lib/vulcan-lib'; -import Popper from '@material-ui/core/Popper'; +import { Components, registerComponent } from '../../lib/vulcan-lib'; const styles = (theme: ThemeType): JssStyles => ({ root: { @@ -24,11 +23,12 @@ anchorEl: HTMLElement|null, width?: number, }) => { - return <Popper className={classes.root} open={hover} anchorEl={anchorEl} placement="left-start"> + const { LWPopper } = Components; + return <LWPopper className={classes.root} open={hover} anchorEl={anchorEl} placement="left-start"> <div className={classes.hoverInfo} style={{width:width}}> { children } </div> - </Popper> + </LWPopper> }; const SidebarHoverOverComponent = registerComponent('SidebarHoverOver', SidebarHoverOver, {styles});
2f28043e91b7f4dce999a9a196cb242e33473f23
AngularJSWithTS/UseTypesEffectivelyInTS/StringsInTS/demo.ts
AngularJSWithTS/UseTypesEffectivelyInTS/StringsInTS/demo.ts
// demo.ts "use strict"; // The stringType variable can be set to any string let unit: string; // The stringLiteralType can only be set to the type value // as well as Null and Undefined, as of now let miles: "MILES"; miles = null; // no error miles = undefined; // no error miles = "awesome"; // error TS2322: Type '"awesome"' is not assignable to type '"MILES"'.
// demo.ts "use strict"; // The stringType variable can be set to any string let unit: string = "awesome"; // The stringLiteralType can only be set to the type value // as well as Null and Undefined, as of now let miles: "MILES"; miles = null; // no error miles = undefined; // no error // miles = "awesome"; // error TS2322: Type '"awesome"' is not assignable to type '"MILES"'. miles = "MILES"; // OK
Edit value for unit. Add one more example
Edit value for unit. Add one more example
TypeScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
--- +++ @@ -3,11 +3,12 @@ "use strict"; // The stringType variable can be set to any string -let unit: string; +let unit: string = "awesome"; // The stringLiteralType can only be set to the type value // as well as Null and Undefined, as of now let miles: "MILES"; miles = null; // no error miles = undefined; // no error -miles = "awesome"; // error TS2322: Type '"awesome"' is not assignable to type '"MILES"'. +// miles = "awesome"; // error TS2322: Type '"awesome"' is not assignable to type '"MILES"'. +miles = "MILES"; // OK
8c87c70658949f82e7b769a2ce445f099f1683fe
src/app/plugins/platform/Docker/registry/getLatestPhpCliAlpineTag.ts
src/app/plugins/platform/Docker/registry/getLatestPhpCliAlpineTag.ts
import createPhpMatcher from './createPhpMatcher'; const getLatestPhpCliTag = createPhpMatcher('cli-alpine'); export default getLatestPhpCliTag;
import createPhpMatcher from './createPhpMatcher'; const getLatestPhpCliAlpineTag = createPhpMatcher('cli-alpine'); export default getLatestPhpCliAlpineTag;
Fix alpine function naming bug
Fix alpine function naming bug
TypeScript
mit
forumone/generator-web-starter,forumone/generator-web-starter,forumone/generator-web-starter,forumone/generator-web-starter,forumone/generator-web-starter
--- +++ @@ -1,5 +1,5 @@ import createPhpMatcher from './createPhpMatcher'; -const getLatestPhpCliTag = createPhpMatcher('cli-alpine'); +const getLatestPhpCliAlpineTag = createPhpMatcher('cli-alpine'); -export default getLatestPhpCliTag; +export default getLatestPhpCliAlpineTag;
2ffb30dc60090535f0eddcf3fe631f6cb524b824
applications/vpn-settings/src/app/components/layout/PrivateHeader.tsx
applications/vpn-settings/src/app/components/layout/PrivateHeader.tsx
import React from 'react'; import { MainLogo, SupportDropdown, TopNavbar, Hamburger } from 'react-components'; interface Props extends React.HTMLProps<HTMLElement> { expanded?: boolean; onToggleExpand: () => void; } const PrivateHeader = ({ expanded, onToggleExpand }: Props) => { return ( <header className="header flex flex-nowrap reset4print"> <MainLogo url="/account" className="nomobile" /> <Hamburger expanded={expanded} onToggle={onToggleExpand} /> <div className="searchbox-container nomobile" /> <TopNavbar> <SupportDropdown /> </TopNavbar> </header> ); }; export default PrivateHeader;
import React from 'react'; import { MainLogo, TopNavbar, Hamburger } from 'react-components'; interface Props extends React.HTMLProps<HTMLElement> { expanded?: boolean; onToggleExpand: () => void; } const PrivateHeader = ({ expanded, onToggleExpand }: Props) => { return ( <header className="header flex flex-nowrap reset4print"> <MainLogo url="/account" className="nomobile" /> <Hamburger expanded={expanded} onToggle={onToggleExpand} /> <div className="searchbox-container nomobile" /> <TopNavbar /> </header> ); }; export default PrivateHeader;
Remove SupportDropdown as Andy want
Remove SupportDropdown as Andy want
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,5 +1,5 @@ import React from 'react'; -import { MainLogo, SupportDropdown, TopNavbar, Hamburger } from 'react-components'; +import { MainLogo, TopNavbar, Hamburger } from 'react-components'; interface Props extends React.HTMLProps<HTMLElement> { expanded?: boolean; @@ -12,9 +12,7 @@ <MainLogo url="/account" className="nomobile" /> <Hamburger expanded={expanded} onToggle={onToggleExpand} /> <div className="searchbox-container nomobile" /> - <TopNavbar> - <SupportDropdown /> - </TopNavbar> + <TopNavbar /> </header> ); };
c0896040674b433fb5763741c053969f3a6e4acd
src/app/time/duration/duration.service.ts
src/app/time/duration/duration.service.ts
import { Injectable } from '@angular/core'; import { Observable, ReplaySubject } from 'rxjs'; import { Track, getTrack } from '../../track/track'; import { ModelService } from '../../model/model.service'; import { Model, ModelTrackEvent } from '../../model/model'; const minDuration = 1; @Injectable() export class DurationService { private durationSubject: ReplaySubject<number>; constructor(private model: ModelService) { this.durationSubject = new ReplaySubject<number>(); this.model.models.subscribe((model) => { this.durationSubject.next(this.buildDuration(model)); }); } get durations(): Observable<number> { return this.durationSubject.asObservable(); } private buildDuration(model: Model): number { const events: ModelTrackEvent[] = []; Object.keys(Track) .map(k => Track[k]) .filter(v => typeof v === 'number') .forEach((track: Track) => { events.push(...getTrack(model, track).events); }); const lastEvent = events.sort((a, b) => b.time - a.time)[0]; const duration = lastEvent ? lastEvent.time : minDuration; return duration < minDuration ? minDuration : duration; } }
import { Injectable } from '@angular/core'; import { Observable, ReplaySubject } from 'rxjs'; import { Track, getTrack } from '../../track/track'; import { ModelService } from '../../model/model.service'; import { Model, ModelTrackEvent } from '../../model/model'; const minDuration = 1; @Injectable() export class DurationService { private durationSubject: ReplaySubject<number>; constructor(private model: ModelService) { this.durationSubject = new ReplaySubject<number>(); this.model.models.subscribe((model) => { this.durationSubject.next(this.buildDuration(model)); }); } get durations(): Observable<number> { return this.durationSubject.asObservable(); } private buildDuration(model: Model): number { const events: ModelTrackEvent[] = []; Object.keys(Track) .map(k => Track[k]) .filter(v => typeof v === 'number') .forEach((track: Track) => { events.push(...getTrack(model, track).events); }); const lastEvent = events.sort((a, b) => b.time - a.time)[0]; const lastLength = lastEvent && (lastEvent as any).length ? (lastEvent as any).length : 0; const duration = lastEvent ? lastEvent.time + lastLength : minDuration; return duration < minDuration ? minDuration : duration; } }
Extend duration if last event is a sustain
fix: Extend duration if last event is a sustain
TypeScript
mit
nb48/chart-hero,nb48/chart-hero,nb48/chart-hero
--- +++ @@ -32,7 +32,8 @@ events.push(...getTrack(model, track).events); }); const lastEvent = events.sort((a, b) => b.time - a.time)[0]; - const duration = lastEvent ? lastEvent.time : minDuration; + const lastLength = lastEvent && (lastEvent as any).length ? (lastEvent as any).length : 0; + const duration = lastEvent ? lastEvent.time + lastLength : minDuration; return duration < minDuration ? minDuration : duration; } }
6ad5c542673d1c8b273c80f46a74be36f5ba0dec
src/GameObject.ts
src/GameObject.ts
import {IUpdatable} from './IUpdatable'; import {IRenderable} from './IRenderable'; /** * A game object defines an entity in your game's world.<br> * It can be for example the player's character, a button, etc. */ export class GameObject implements IUpdatable, IRenderable { constructor() { this.create(); } /** * Called when the game object is created.<br> * You can set the game object's properties in here, use the loader * to load textures, etc... */ public create(): void { } /** * Called every frame as long as the game object is in the active scene.<br> * You can update your object property from here to, for example, move a * character if a keyboard key is being pressed. */ public update(): void { } /** * Called every frame as long as the game object is in the active scene.<br> * Render the game object to the screen using the renderer's 2D context. * @param context The renderer's context, automatically passed in. */ public render(context: CanvasRenderingContext2D): void { } }
import {IUpdatable} from './IUpdatable'; import {IRenderable} from './IRenderable'; import {Scene} from './Scene'; import {Game} from './Game'; /** * A game object defines an entity in your game's world.<br> * It can be for example the player's character, a button, etc. */ export class GameObject implements IUpdatable, IRenderable { /** The current or last scene this game object's instance belonged to. */ public scene: Scene; constructor() { this.create(); } /** * A reference to your main Game instance. */ public get game(): Game { return this.scene.game; } /** * Called when the game object is created.<br> * You can set the game object's properties in here, use the loader * to load textures, etc... */ public create(): void { } /** * Called every frame as long as the game object is in the active scene.<br> * You can update your object property from here to, for example, move a * character if a keyboard key is being pressed. */ public update(): void { } /** * Called every frame as long as the game object is in the active scene.<br> * Render the game object to the screen using the renderer's 2D context. * @param context The renderer's context, automatically passed in. */ public render(context: CanvasRenderingContext2D): void { } }
Add scene and game ref
Add scene and game ref
TypeScript
mit
ChibiFR/rythmoos-engine,ChibiFR/rythmoos-engine
--- +++ @@ -1,13 +1,25 @@ import {IUpdatable} from './IUpdatable'; import {IRenderable} from './IRenderable'; +import {Scene} from './Scene'; +import {Game} from './Game'; /** * A game object defines an entity in your game's world.<br> * It can be for example the player's character, a button, etc. */ export class GameObject implements IUpdatable, IRenderable { + /** The current or last scene this game object's instance belonged to. */ + public scene: Scene; + constructor() { this.create(); + } + + /** + * A reference to your main Game instance. + */ + public get game(): Game { + return this.scene.game; } /**
f12927c0e3d0a3319fe0e7696af600be3843c3fc
front/react/components/header/nav-item.tsx
front/react/components/header/nav-item.tsx
import * as React from 'react'; const headerStyle: React.CSSProperties = { color: 'white', fontSize: '1.2em', fontWeight: 'bold', paddingLeft: '20px', height: '20px', display: 'block' } const NavItem = (props: { name: string, href: string }) => ( <div style={headerStyle}> <a href={props.href}> {props.name} </a> </div> ) export default NavItem
import * as React from 'react'; import Anchor from '../anchor'; const NavItem = (props: { text: string, href: string }) => ( <div style={headerStyle}> <Anchor href={props.href} text={props.text} /> </div> ) const headerStyle: React.CSSProperties = { color: 'white', fontSize: '1.2em', fontWeight: 'bold', paddingRight: '20px', height: '20px', display: 'block' } export default NavItem
Change NavItem padding to right and use Anchor cpnt
Change NavItem padding to right and use Anchor cpnt
TypeScript
mit
the-concierge/concierge,the-concierge/concierge,the-concierge/concierge,paypac/node-concierge,paypac/node-concierge,paypac/node-concierge,paypac/node-concierge
--- +++ @@ -1,20 +1,19 @@ import * as React from 'react'; +import Anchor from '../anchor'; + +const NavItem = (props: { text: string, href: string }) => ( + <div style={headerStyle}> + <Anchor href={props.href} text={props.text} /> + </div> +) const headerStyle: React.CSSProperties = { color: 'white', fontSize: '1.2em', fontWeight: 'bold', - paddingLeft: '20px', + paddingRight: '20px', height: '20px', display: 'block' } -const NavItem = (props: { name: string, href: string }) => ( - <div style={headerStyle}> - <a href={props.href}> - {props.name} - </a> - </div> -) - export default NavItem
566539727d0ca1f3cdcd790a4e48f780e9232a39
frontend/src/component/feature/FeatureView2/FeatureMetrics/FeatureMetrics.tsx
frontend/src/component/feature/FeatureView2/FeatureMetrics/FeatureMetrics.tsx
import { useParams } from 'react-router'; import useFeature from '../../../../hooks/api/getters/useFeature/useFeature'; import MetricComponent from '../../view/metric-container'; import { useStyles } from './FeatureMetrics.styles'; import { IFeatureViewParams } from '../../../../interfaces/params'; import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig'; import ConditionallyRender from '../../../common/ConditionallyRender'; import EnvironmentMetricComponent from '../EnvironmentMetricComponent/EnvironmentMetricComponent'; const FeatureMetrics = () => { const styles = useStyles(); const { projectId, featureId } = useParams<IFeatureViewParams>(); const { feature } = useFeature(projectId, featureId); const { uiConfig } = useUiConfig(); const isEnterprise = uiConfig.flags.E; return ( <div className={styles.container}> <ConditionallyRender condition={isEnterprise} show={<EnvironmentMetricComponent />} elseShow={<MetricComponent featureToggle={feature} />} /> </div> ); }; export default FeatureMetrics;
import { useParams } from 'react-router'; import useFeature from '../../../../hooks/api/getters/useFeature/useFeature'; import MetricComponent from '../../view/metric-container'; import { useStyles } from './FeatureMetrics.styles'; import { IFeatureViewParams } from '../../../../interfaces/params'; import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig'; import ConditionallyRender from '../../../common/ConditionallyRender'; import EnvironmentMetricComponent from '../EnvironmentMetricComponent/EnvironmentMetricComponent'; const FeatureMetrics = () => { const styles = useStyles(); const { projectId, featureId } = useParams<IFeatureViewParams>(); const { feature } = useFeature(projectId, featureId); const { uiConfig } = useUiConfig(); const isNewMetricsEnabled = uiConfig.flags.V; return ( <div className={styles.container}> <ConditionallyRender condition={isNewMetricsEnabled} show={<EnvironmentMetricComponent />} elseShow={<MetricComponent featureToggle={feature} />} /> </div> ); }; export default FeatureMetrics;
Use V flag for new metrics component
Use V flag for new metrics component
TypeScript
apache-2.0
Unleash/unleash,Unleash/unleash,Unleash/unleash,Unleash/unleash
--- +++ @@ -12,11 +12,11 @@ const { projectId, featureId } = useParams<IFeatureViewParams>(); const { feature } = useFeature(projectId, featureId); const { uiConfig } = useUiConfig(); - const isEnterprise = uiConfig.flags.E; + const isNewMetricsEnabled = uiConfig.flags.V; return ( <div className={styles.container}> - <ConditionallyRender condition={isEnterprise} + <ConditionallyRender condition={isNewMetricsEnabled} show={<EnvironmentMetricComponent />} elseShow={<MetricComponent featureToggle={feature} />} />
ca97842f85a569f6123f62976f35c51986ffd586
src/app/optimizer/optimizer.component.spec.ts
src/app/optimizer/optimizer.component.spec.ts
import { beforeEach, beforeEachProviders, describe, expect, it, inject, } from '@angular/core/testing'; import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { OptimizerComponent } from './optimizer.component'; describe('Component: Optimizer', () => { let builder: TestComponentBuilder; beforeEachProviders(() => [OptimizerComponent]); beforeEach(inject([TestComponentBuilder], function (tcb: TestComponentBuilder) { builder = tcb; })); it('should inject the component', inject([OptimizerComponent], (component: OptimizerComponent) => { expect(component).toBeTruthy(); })); it('should create the component', inject([], () => { return builder.createAsync(OptimizerComponentTestController) .then((fixture: ComponentFixture<any>) => { let query = fixture.debugElement.query(By.directive(OptimizerComponent)); expect(query).toBeTruthy(); expect(query.componentInstance).toBeTruthy(); }); })); }); @Component({ selector: 'test', template: ` <optimizer></optimizer> `, directives: [OptimizerComponent] }) class OptimizerComponentTestController { }
import { beforeEach, beforeEachProviders, describe, expect, it, inject, } from '@angular/core/testing'; import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { OptimizerComponent } from './optimizer.component'; describe('Component: Optimizer', () => { let builder: TestComponentBuilder; beforeEachProviders(() => [OptimizerComponent]); beforeEach(inject([TestComponentBuilder], function (tcb: TestComponentBuilder) { builder = tcb; })); it('should inject the optimizer component.', inject([OptimizerComponent], (component: OptimizerComponent) => { expect(component).toBeTruthy(); })); it('should create three panels.', inject([], () => { return builder.createAsync(OptimizerComponentTestController) .then((fixture: ComponentFixture<any>) => { let childNodes = fixture.debugElement.childNodes; expect(childNodes.length).toEqual(3); let inputPanel = fixture.debugElement.query(By.css('user-input')); expect(inputPanel).toBeTruthy(); let barchartPanel = fixture.debugElement.query(By.css('barchart')); expect(barchartPanel).toBeTruthy(); let resultsTablePanel = fixture.debugElement.query(By.css('results-table')); expect(resultsTablePanel).toBeTruthy(); }); })); }); @Component({ selector: 'test', template: ` <optimizer></optimizer> `, directives: [OptimizerComponent] }) class OptimizerComponentTestController { }
Test optimizer component makes panels.
Test optimizer component makes panels.
TypeScript
mit
coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer
--- +++ @@ -19,17 +19,23 @@ builder = tcb; })); - it('should inject the component', inject([OptimizerComponent], + it('should inject the optimizer component.', inject([OptimizerComponent], (component: OptimizerComponent) => { expect(component).toBeTruthy(); })); - it('should create the component', inject([], () => { + it('should create three panels.', inject([], () => { return builder.createAsync(OptimizerComponentTestController) .then((fixture: ComponentFixture<any>) => { - let query = fixture.debugElement.query(By.directive(OptimizerComponent)); - expect(query).toBeTruthy(); - expect(query.componentInstance).toBeTruthy(); + let childNodes = fixture.debugElement.childNodes; + expect(childNodes.length).toEqual(3); + + let inputPanel = fixture.debugElement.query(By.css('user-input')); + expect(inputPanel).toBeTruthy(); + let barchartPanel = fixture.debugElement.query(By.css('barchart')); + expect(barchartPanel).toBeTruthy(); + let resultsTablePanel = fixture.debugElement.query(By.css('results-table')); + expect(resultsTablePanel).toBeTruthy(); }); })); });
935791e575cd4f0ac0ab0026856d79f8eea31bfe
src/urlhandler.android.ts
src/urlhandler.android.ts
import * as application from 'application'; import { getCallback, extractAppURL } from './urlhandler.common'; export { handleOpenURL } from './urlhandler.common'; export function handleIntent(intent: any) { let data = intent.getData(); try { let appURL = extractAppURL(data); if (appURL != null && (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf() || new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf())) { try { setTimeout(() => getCallback()(appURL)); } catch (ignored) { application.android.on(application.AndroidApplication.activityResultEvent, () => { setTimeout(() => getCallback()(appURL)); }); } } } catch (e) { console.error('Unknown error during getting App URL data', e); } } application.android.on(application.AndroidApplication.activityNewIntentEvent, (args) => { setTimeout(() => { let intent: android.content.Intent = args.activity.getIntent(); try { handleIntent(intent); } catch (e) { console.error('Unknown error during getting App URL data', e); } }); });
import * as application from 'application'; import { getCallback, extractAppURL } from './urlhandler.common'; export { handleOpenURL } from './urlhandler.common'; export function handleIntent(intent: any) { let data = intent.getData(); try { let appURL = extractAppURL(data); if (appURL != null && (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf() || new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf())) { try { setTimeout(() => { let result = getCallback()(appURL); // clear intent so that url will not be re-handled upon subsequent ActivityStarted event intent.setAction(''); intent.setData(null); return result; }); } catch (ignored) { application.android.on(application.AndroidApplication.activityResultEvent, () => { setTimeout(() => getCallback()(appURL)); }); } } } catch (e) { console.error('Unknown error during getting App URL data', e); } } application.android.on(application.AndroidApplication.activityNewIntentEvent, (args) => { setTimeout(() => { let intent: android.content.Intent = args.activity.getIntent(); try { handleIntent(intent); } catch (e) { console.error('Unknown error during getting App URL data', e); } }); });
Resolve timing issues and clearing intent
fix(Android): Resolve timing issues and clearing intent see #91 and making #108 obsolete
TypeScript
mit
hypery2k/nativescript-urlhandler,hypery2k/nativescript-urlhandler,hypery2k/nativescript-urlhandler,hypery2k/nativescript-urlhandler
--- +++ @@ -11,7 +11,13 @@ (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf() || new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf())) { try { - setTimeout(() => getCallback()(appURL)); + setTimeout(() => { + let result = getCallback()(appURL); + // clear intent so that url will not be re-handled upon subsequent ActivityStarted event + intent.setAction(''); + intent.setData(null); + return result; + }); } catch (ignored) { application.android.on(application.AndroidApplication.activityResultEvent, () => { setTimeout(() => getCallback()(appURL));
6da83bcb6d0d7ee16e824eb6e11f480457135932
app/utilities/date-service.ts
app/utilities/date-service.ts
import { Injectable } from "@angular/core"; @Injectable() export class DateService { constructor() {} toMonthAndDay(date: string) { return new Date(date).toLocaleDateString([], { month: "long", day: "numeric" }); } toMonthDayTime(date: string) { return new Date(date).toLocaleTimeString([], { month: "long", day: "numeric" }); } }
import { Injectable } from "@angular/core"; @Injectable() export class DateService { constructor() {} toMonthAndDay(date: string) { let monthAndDay = new Date(date); return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()}`; } toMonthDayTime(date: string) { let monthAndDay = new Date(date); return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()} ${monthAndDay.toLocaleTimeString()}`; } }
Fix dates, they were off by 1 day because of timezones.
Fix dates, they were off by 1 day because of timezones.
TypeScript
mit
blatzblaster/ionic-solo,blatzblaster/ionic-solo,blatzblaster/ionic-solo
--- +++ @@ -5,10 +5,12 @@ constructor() {} toMonthAndDay(date: string) { - return new Date(date).toLocaleDateString([], { month: "long", day: "numeric" }); + let monthAndDay = new Date(date); + return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()}`; } toMonthDayTime(date: string) { - return new Date(date).toLocaleTimeString([], { month: "long", day: "numeric" }); + let monthAndDay = new Date(date); + return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()} ${monthAndDay.toLocaleTimeString()}`; } }
f6f5997a5770e4c4dbad33b49cda6511bf91a5d9
step-release-vis/src/app/services/environment_test.ts
step-release-vis/src/app/services/environment_test.ts
import { TestBed } from '@angular/core/testing'; import { EnvironmentService } from './environment'; import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('EnvironmentService', () => { let service: EnvironmentService; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule] }); service = TestBed.inject(EnvironmentService); }); it('should be created', () => { expect(service).toBeTruthy(); }); // TODO(naoai): write getPolygons test // TODO(ancar): test getPercentages });
import { TestBed } from '@angular/core/testing'; import { EnvironmentService } from './environment'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import {CandidateInfo} from '../models/Data'; describe('EnvironmentService', () => { let service: EnvironmentService; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule] }); service = TestBed.inject(EnvironmentService); }); // TODO(naoai): write getPolygons test // TODO(ancar): test getPercentages it('#getPercentages should return 3 candidates with ~ equal percentages', () => { const input: CandidateInfo[] = [{name: '1', job_count: 666}, {name: '2', job_count: 667}, {name: '3', job_count: 667}]; // @ts-ignore const resultMap: Map<string, number> = service.getPercentages(input); expect(resultMap.get('1')).toEqual(34); expect(resultMap.get('2')).toEqual(33); expect(resultMap.get('3')).toEqual(33); }); it('#getPercentages should have a candidate with 100', () => { const input: CandidateInfo[] = [{name: '1', job_count: 2000}, {name: '2', job_count: 0}]; // @ts-ignore const resultMap: Map<string, number> = service.getPercentages(input); expect(resultMap.get('1')).toEqual(100); }); });
Add 2 tests for getPercentages.
Add 2 tests for getPercentages.
TypeScript
apache-2.0
googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020
--- +++ @@ -2,6 +2,7 @@ import { EnvironmentService } from './environment'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import {CandidateInfo} from '../models/Data'; describe('EnvironmentService', () => { let service: EnvironmentService; @@ -13,10 +14,24 @@ service = TestBed.inject(EnvironmentService); }); - it('should be created', () => { - expect(service).toBeTruthy(); + // TODO(naoai): write getPolygons test + // TODO(ancar): test getPercentages + it('#getPercentages should return 3 candidates with ~ equal percentages', () => { + const input: CandidateInfo[] = [{name: '1', job_count: 666}, {name: '2', job_count: 667}, + {name: '3', job_count: 667}]; + // @ts-ignore + const resultMap: Map<string, number> = service.getPercentages(input); + + expect(resultMap.get('1')).toEqual(34); + expect(resultMap.get('2')).toEqual(33); + expect(resultMap.get('3')).toEqual(33); }); - // TODO(naoai): write getPolygons test - // TODO(ancar): test getPercentages + it('#getPercentages should have a candidate with 100', () => { + const input: CandidateInfo[] = [{name: '1', job_count: 2000}, {name: '2', job_count: 0}]; + // @ts-ignore + const resultMap: Map<string, number> = service.getPercentages(input); + + expect(resultMap.get('1')).toEqual(100); + }); });
14fd67f422a2bb3b2067a465b4ce7a00ff614ca6
src/main/components/GlobalStyle.tsx
src/main/components/GlobalStyle.tsx
import { createGlobalStyle } from 'styled-components' const GlobalStyle = createGlobalStyle` a { color: inherit; } ` export default GlobalStyle
import { createGlobalStyle } from 'styled-components' const GlobalStyle = createGlobalStyle` body { color: #DDD; background-color: #252525; } a { color: inherit; } ` export default GlobalStyle
Apply global background color and text color
Apply global background color and text color
TypeScript
mit
Sarah-Seo/Inpad,Sarah-Seo/Inpad
--- +++ @@ -1,6 +1,10 @@ import { createGlobalStyle } from 'styled-components' const GlobalStyle = createGlobalStyle` + body { + color: #DDD; + background-color: #252525; + } a { color: inherit; }
79ec518d1ee2ac102ef98e252af111ef9941857c
applications/account/src/app/signup/CheckoutButton.tsx
applications/account/src/app/signup/CheckoutButton.tsx
import React from 'react'; import { PAYMENT_METHOD_TYPE, PAYMENT_METHOD_TYPES } from '@proton/shared/lib/constants'; import { c } from 'ttag'; import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces'; import { PrimaryButton, PayPalButton } from '@proton/components'; import { SignupPayPal } from './interfaces'; interface Props { className?: string; paypal: SignupPayPal; canPay: boolean; loading: boolean; method?: PAYMENT_METHOD_TYPE; checkResult?: SubscriptionCheckResponse; } const CheckoutButton = ({ className, paypal, canPay, loading, method, checkResult }: Props) => { if (method === PAYMENT_METHOD_TYPES.PAYPAL) { return ( <PayPalButton paypal={paypal} flow="signup" color="norm" className={className} amount={checkResult ? checkResult.AmountDue : 0} >{c('Action').t`Pay`}</PayPalButton> ); } if (checkResult && !checkResult.AmountDue) { return ( <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Confirm`}</PrimaryButton> ); } return ( <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Pay`}</PrimaryButton> ); }; export default CheckoutButton;
import React from 'react'; import { PAYMENT_METHOD_TYPE, PAYMENT_METHOD_TYPES } from '@proton/shared/lib/constants'; import { c } from 'ttag'; import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces'; import { PrimaryButton, StyledPayPalButton } from '@proton/components'; import { SignupPayPal } from './interfaces'; interface Props { className?: string; paypal: SignupPayPal; canPay: boolean; loading: boolean; method?: PAYMENT_METHOD_TYPE; checkResult?: SubscriptionCheckResponse; } const CheckoutButton = ({ className, paypal, canPay, loading, method, checkResult }: Props) => { if (method === PAYMENT_METHOD_TYPES.PAYPAL) { return ( <StyledPayPalButton paypal={paypal} flow="signup" className={className} amount={checkResult ? checkResult.AmountDue : 0} /> ); } if (checkResult && !checkResult.AmountDue) { return ( <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Confirm`}</PrimaryButton> ); } return ( <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action') .t`Pay`}</PrimaryButton> ); }; export default CheckoutButton;
Use StyledPayPalButton on signup checkout
Use StyledPayPalButton on signup checkout CP-2283
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -3,7 +3,7 @@ import { c } from 'ttag'; import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces'; -import { PrimaryButton, PayPalButton } from '@proton/components'; +import { PrimaryButton, StyledPayPalButton } from '@proton/components'; import { SignupPayPal } from './interfaces'; interface Props { @@ -18,13 +18,12 @@ const CheckoutButton = ({ className, paypal, canPay, loading, method, checkResult }: Props) => { if (method === PAYMENT_METHOD_TYPES.PAYPAL) { return ( - <PayPalButton + <StyledPayPalButton paypal={paypal} flow="signup" - color="norm" className={className} amount={checkResult ? checkResult.AmountDue : 0} - >{c('Action').t`Pay`}</PayPalButton> + /> ); }
293cef59776e0958b1ad57d3f54eb2871589b90a
src/objects/maintenance_and_transport_object.ts
src/objects/maintenance_and_transport_object.ts
import {AbstractObject} from "./_abstract_object"; export class MaintenanceAndTransportObject extends AbstractObject { public getType(): string { return "TOBJ"; } public getArea(): string | undefined { if (this.getFiles().length === 0) { return undefined; } const xml = this.getFiles()[0].getRaw(); const result = xml.match(/<AREA>(\w+)<\/AREA>/); if (result) { return result[1]; } else { return undefined; } } }
import {AbstractObject} from "./_abstract_object"; export class MaintenanceAndTransportObject extends AbstractObject { public getType(): string { return "TOBJ"; } public getArea(): string | undefined { if (this.getFiles().length === 0) { return undefined; } const xml = this.getFiles()[0].getRaw(); const result = xml.match(/<AREA>([\w\/]+)<\/AREA>/); if (result) { return result[1]; } else { return undefined; } } }
Adjust AREA regex for reserved namespaces
Adjust AREA regex for reserved namespaces Fixes #410
TypeScript
mit
larshp/abaplint,larshp/abapOpenChecksJS,larshp/abapOpenChecksJS,larshp/abaplint,larshp/abaplint,larshp/abaplint,larshp/abapOpenChecksJS
--- +++ @@ -13,7 +13,7 @@ const xml = this.getFiles()[0].getRaw(); - const result = xml.match(/<AREA>(\w+)<\/AREA>/); + const result = xml.match(/<AREA>([\w\/]+)<\/AREA>/); if (result) { return result[1]; } else {
e9e0afeb5bb0702e458efdd8e455539d7ceb8490
src/rancher/cluster-actions/CreateNodeAction.ts
src/rancher/cluster-actions/CreateNodeAction.ts
import { translate } from '@waldur/i18n'; import { $uibModal } from '@waldur/modal/services'; import { ActionContext, ResourceAction } from '@waldur/resource/actions/types'; export function createNodeAction(ctx: ActionContext): ResourceAction { return { name: 'create_node', title: translate('Create node'), type: 'callback', tab: 'nodes', execute: () => { $uibModal.open({ component: 'rancherCreateNodeDialog', resolve: { cluster: ctx.resource, }, }); }, }; }
import { translate } from '@waldur/i18n'; import { $uibModal } from '@waldur/modal/services'; import { ActionContext, ResourceAction } from '@waldur/resource/actions/types'; export function createNodeAction(ctx: ActionContext): ResourceAction { return { name: 'create_node', title: translate('Create node'), iconClass: 'fa fa-plus', type: 'callback', tab: 'nodes', execute: () => { $uibModal.open({ component: 'rancherCreateNodeDialog', resolve: { cluster: ctx.resource, }, }); }, }; }
Add icon for node create action.
Add icon for node create action.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -6,6 +6,7 @@ return { name: 'create_node', title: translate('Create node'), + iconClass: 'fa fa-plus', type: 'callback', tab: 'nodes', execute: () => {
5dcfc57e4f868bd24abcfbd3aee1d741c25e631e
types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx
types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx
import * as React from 'react'; import ReactScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed'; () => ( <ReactScrollIntoViewIfNeeded active={true} options={{ block: 'start', scrollMode: 'if-needed', skipOverflowHiddenElements: true }} elementType="h1" > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded options={invalidOptions} // $ExpectError > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded active={5} // $ExpectError > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded elementType="h8" // $ExpectError > Children </ReactScrollIntoViewIfNeeded> );
import * as React from 'react'; import ReactScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed'; const validOptions = { block: 'start', scrollMode: 'if-needed', skipOverflowHiddenElements: true }; const invalidOptions = { invalidOption: 'foobar' }; () => ( <ReactScrollIntoViewIfNeeded active={true} options={{ block: 'start', scrollMode: 'if-needed', skipOverflowHiddenElements: true }} elementType="h1" > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded options={{ invalidOption: 'foobar' // $ExpectError }} > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded active={5} // $ExpectError > Children </ReactScrollIntoViewIfNeeded> ); () => ( <ReactScrollIntoViewIfNeeded elementType="h8" // $ExpectError > Children </ReactScrollIntoViewIfNeeded> );
Write better failing options test
[react-scroll-into-view-if-needed] Write better failing options test
TypeScript
mit
dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,markogresak/DefinitelyTyped,georgemarshall/DefinitelyTyped,mcliment/DefinitelyTyped,borisyankov/DefinitelyTyped
--- +++ @@ -1,5 +1,15 @@ import * as React from 'react'; import ReactScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed'; + +const validOptions = { + block: 'start', + scrollMode: 'if-needed', + skipOverflowHiddenElements: true +}; + +const invalidOptions = { + invalidOption: 'foobar' +}; () => ( <ReactScrollIntoViewIfNeeded @@ -17,7 +27,9 @@ () => ( <ReactScrollIntoViewIfNeeded - options={invalidOptions} // $ExpectError + options={{ + invalidOption: 'foobar' // $ExpectError + }} > Children </ReactScrollIntoViewIfNeeded>
0dbd55f505f8afd0cd7f1256bb7ed5156fbe157d
lib/settings/DefaultSettings.ts
lib/settings/DefaultSettings.ts
import {VoidHook} from "../tasks/Hooks"; export default { projectType: "frontend", port: 5000, liveReloadPort: 35729, distribution: "dist", targets: "targets", bootstrapperStyles: "", watchStyles: [ "styles" ], test: "test/**/*.ts", images: "images", assets: "assets", autoprefixer: ["last 2 versions", "> 1%"], scripts: "scripts/**/*.{ts,tsx}", revisionExclude: [], nodemon: {}, uglifyjs: { output: { "ascii_only": true } }, preBuild: VoidHook, postBuild: VoidHook }
import {VoidHook} from "../tasks/Hooks"; export default { projectType: "frontend", port: 5000, liveReloadPort: 35729, distribution: "dist", targets: "targets", bootstrapperStyles: "", watchStyles: [ "styles" ], test: "test/**/*.ts", images: "images", assets: "assets", autoprefixer: ["last 2 versions", "> 1%"], scripts: "scripts/**/*.{ts,tsx}", revisionExclude: [], nodemon: {}, uglifyjs: { output: { "ascii_only": true } }, preBuild: VoidHook, postBuild: VoidHook, typescriptPath: require.resolve("typescript") }
Add typescript path in default settings
Add typescript path in default settings
TypeScript
mit
mtfranchetto/smild,mtfranchetto/smild,mtfranchetto/smild
--- +++ @@ -23,5 +23,6 @@ } }, preBuild: VoidHook, - postBuild: VoidHook + postBuild: VoidHook, + typescriptPath: require.resolve("typescript") }
89316cafcc98edca00d500f52fc71e3b4ead665e
app/utils/ItemUtils.ts
app/utils/ItemUtils.ts
/// <reference path="../References.d.ts"/> import Dispatcher from '../dispatcher/Dispatcher'; import * as ItemTypes from '../types/ItemTypes'; import * as ItemActions from '../actions/ItemActions'; export function init(): Promise<string> { return new Promise<string>((resolve): void => { let data: ItemTypes.Item[] = [ { id: '1001', content: 'Item One', }, { id: '1002', content: 'Item Two', }, { id: '1003', content: 'Item Three', }, ]; ItemActions.loading(); setTimeout(() => { ItemActions.load(data); resolve(); }, 1000); }); }
/// <reference path="../References.d.ts"/> import * as ItemTypes from '../types/ItemTypes'; import * as ItemActions from '../actions/ItemActions'; export function init(): Promise<string> { return new Promise<string>((resolve): void => { let data: ItemTypes.Item[] = [ { id: '1001', content: 'Item One', }, { id: '1002', content: 'Item Two', }, { id: '1003', content: 'Item Three', }, ]; ItemActions.loading(); setTimeout(() => { ItemActions.load(data); resolve(); }, 1000); }); }
Remove unused import in item utils
Remove unused import in item utils
TypeScript
mit
zachhuff386/react-boilerplate,zachhuff386/react-boilerplate
--- +++ @@ -1,5 +1,4 @@ /// <reference path="../References.d.ts"/> -import Dispatcher from '../dispatcher/Dispatcher'; import * as ItemTypes from '../types/ItemTypes'; import * as ItemActions from '../actions/ItemActions';
ab953e5dec27257b0141b4efda29489fd75f921c
src/shell/CommandExpander.ts
src/shell/CommandExpander.ts
import {Aliases} from "../Aliases"; import {scan, Token, concatTokens} from "./Scanner"; export function expandAliases(tokens: Token[], aliases: Aliases): Token[] { const commandWordToken = tokens[0]; const argumentTokens = tokens.slice(1); const alias: string = aliases.get(commandWordToken.value); if (alias) { const aliasTokens = scan(alias); const isRecursive = aliasTokens[0].value === commandWordToken.value; if (isRecursive) { return concatTokens(aliasTokens, argumentTokens); } else { return concatTokens(expandAliases(scan(alias), aliases), argumentTokens); } } else { return tokens; } }
import {Aliases} from "../Aliases"; import {scan, Token, concatTokens} from "./Scanner"; export function expandAliases(tokens: Token[], aliases: Aliases): Token[] { if (tokens.length === 0) { return []; } const commandWordToken = tokens[0]; const argumentTokens = tokens.slice(1); const alias: string = aliases.get(commandWordToken.value); if (alias) { const aliasTokens = scan(alias); const isRecursive = aliasTokens[0].value === commandWordToken.value; if (isRecursive) { return concatTokens(aliasTokens, argumentTokens); } else { return concatTokens(expandAliases(scan(alias), aliases), argumentTokens); } } else { return tokens; } }
Add a shortcut for expandAliases.
Add a shortcut for expandAliases.
TypeScript
mit
j-allard/black-screen,railsware/upterm,drew-gross/black-screen,black-screen/black-screen,vshatskyi/black-screen,vshatskyi/black-screen,drew-gross/black-screen,drew-gross/black-screen,drew-gross/black-screen,shockone/black-screen,black-screen/black-screen,railsware/upterm,vshatskyi/black-screen,black-screen/black-screen,vshatskyi/black-screen,j-allard/black-screen,j-allard/black-screen,shockone/black-screen
--- +++ @@ -2,6 +2,10 @@ import {scan, Token, concatTokens} from "./Scanner"; export function expandAliases(tokens: Token[], aliases: Aliases): Token[] { + if (tokens.length === 0) { + return []; + } + const commandWordToken = tokens[0]; const argumentTokens = tokens.slice(1); const alias: string = aliases.get(commandWordToken.value);
f0b39ce890e8f31523739a68d317b24df79fdb76
src/Umbraco.Tests.AcceptanceTest/cypress/integration/Settings/languages.ts
src/Umbraco.Tests.AcceptanceTest/cypress/integration/Settings/languages.ts
/// <reference types="Cypress" /> context('Languages', () => { beforeEach(() => { cy.umbracoLogin(Cypress.env('username'), Cypress.env('password')); }); it('Add language', () => { const name = "Kyrgyz (Kyrgyzstan)"; // Must be an option in the select box cy.umbracoEnsureLanguageNameNotExists(name); cy.umbracoSection('settings'); cy.get('li .umb-tree-root:contains("Settings")').should("be.visible"); cy.umbracoTreeItem("settings", ["Languages"]).click(); cy.umbracoButtonByLabelKey("languages_addLanguage").click(); cy.get('select[name="newLang"]').select(name); // //Save cy.get('.btn-success').click(); //Assert cy.umbracoSuccessNotification().should('be.visible'); //Clean up cy.umbracoEnsureLanguageNameNotExists(name); }); });
/// <reference types="Cypress" /> context('Languages', () => { beforeEach(() => { cy.umbracoLogin(Cypress.env('username'), Cypress.env('password')); }); it('Add language', () => { // For some reason the languages to chose fom seems to be translated differently than normal, as an example: // My system is set to EN (US), but most languages are translated into Danish for some reason // Aghem seems untranslated though? const name = "Aghem"; // Must be an option in the select box cy.umbracoEnsureLanguageNameNotExists(name); cy.umbracoSection('settings'); cy.get('li .umb-tree-root:contains("Settings")').should("be.visible"); cy.umbracoTreeItem("settings", ["Languages"]).click(); cy.umbracoButtonByLabelKey("languages_addLanguage").click(); cy.get('select[name="newLang"]').select(name); // //Save cy.get('.btn-success').click(); //Assert cy.umbracoSuccessNotification().should('be.visible'); //Clean up cy.umbracoEnsureLanguageNameNotExists(name); }); });
Align 'Add language' test to netcore
Align 'Add language' test to netcore
TypeScript
mit
leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS
--- +++ @@ -6,7 +6,10 @@ }); it('Add language', () => { - const name = "Kyrgyz (Kyrgyzstan)"; // Must be an option in the select box + // For some reason the languages to chose fom seems to be translated differently than normal, as an example: + // My system is set to EN (US), but most languages are translated into Danish for some reason + // Aghem seems untranslated though? + const name = "Aghem"; // Must be an option in the select box cy.umbracoEnsureLanguageNameNotExists(name);
10b75c1a86cc778186e34c0dec4afd7d3885c09a
app/hero-detail.component.ts
app/hero-detail.component.ts
import { Component, OnInit } from '@angular/core'; import { RouteParams } from '@angular/router-deprecated'; import { PolymerElement } from 'vaadin-ng2-polymer/polymer-element'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ selector: 'my-hero-detail', template: ` <div *ngIf="hero"> <paper-input label="Name" [(value)]="hero.name"></paper-input> <vaadin-date-picker label="Birthday" [(value)]="hero.birthday"></vaadin-date-picker> </div> `, directives: [ PolymerElement('paper-input'), PolymerElement('vaadin-date-picker') ], styles: [` :host { display: block; padding: 16px; } paper-input[label="Name"] { --paper-input-container-label: { @apply(--paper-font-display1); transition: transform 0.25s, width 0.25s, font 0.25s; }; --paper-input-container-label-floating: { @apply(--paper-font-subhead); }; --paper-input-container-input: { @apply(--paper-font-display1); }; } `] }) export class HeroDetailComponent implements OnInit { hero: Hero; constructor( private _routeParams: RouteParams, private _heroService: HeroService ) { } ngOnInit() { let id = +this._routeParams.get('id'); this._heroService.getHero(id).then(hero => this.hero = hero); } }
import { Component, OnInit } from '@angular/core'; import { RouteParams } from '@angular/router-deprecated'; import { PolymerElement } from 'vaadin-ng2-polymer/polymer-element'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ selector: 'my-hero-detail', template: ` <div *ngIf="hero"> <paper-input label="Name" [(value)]="hero.name"></paper-input> <vaadin-date-picker label="Birthday" [(value)]="hero.birthday"></vaadin-date-picker> </div> `, directives: [ PolymerElement('paper-input'), PolymerElement('vaadin-date-picker') ], styles: [` :host { display: block; padding: 16px; } `] }) export class HeroDetailComponent implements OnInit { hero: Hero; constructor( private _routeParams: RouteParams, private _heroService: HeroService ) { } ngOnInit() { let id = +this._routeParams.get('id'); this._heroService.getHero(id).then(hero => this.hero = hero); } }
Change hero name input font size back to default
Change hero name input font size back to default
TypeScript
mit
platosha/angular2-polymer-elements-quickstart,vaibhavnitya/meethi,vaibhavnitya/meethi,platosha/angular2-polymer-elements-quickstart,platosha/angular2-polymer-elements-quickstart,vaibhavnitya/meethi
--- +++ @@ -22,21 +22,6 @@ display: block; padding: 16px; } - - paper-input[label="Name"] { - --paper-input-container-label: { - @apply(--paper-font-display1); - transition: transform 0.25s, width 0.25s, font 0.25s; - }; - - --paper-input-container-label-floating: { - @apply(--paper-font-subhead); - }; - - --paper-input-container-input: { - @apply(--paper-font-display1); - }; - } `] }) export class HeroDetailComponent implements OnInit {
a5bf3cfe912213fed94751368f51bb9aa96a971f
src/app/_core/models/player-state.ts
src/app/_core/models/player-state.ts
import { Video } from './video.model'; import { PlayerSide } from './player-side'; export interface PlayerState { side: PlayerSide; player: YT.Player; playerId: string; video: Video; isReady: boolean; state: number; volume: number; speed: number; }
import { Video } from './video.model'; import { PlayerSide } from './player-side'; export interface PlayerState { side: PlayerSide; playerId: string; video: Video; isReady: boolean; state: number; volume: number; speed: number; }
Remove player in PlayerState interface
Remove player in PlayerState interface
TypeScript
mit
radiium/turntable,radiium/turntable,radiium/turntable
--- +++ @@ -3,7 +3,6 @@ export interface PlayerState { side: PlayerSide; - player: YT.Player; playerId: string; video: Video; isReady: boolean;
05cf69c4f982b91cda455d60955d9021a13abee3
src/interfaces.ts
src/interfaces.ts
export interface Attachment { id?: string content_type: string data: string } export interface CouchifyOptions { id?: string baseDocumentsDir?: string attachmentsDir?: string babelPlugins?: any[] babelPresets?: any[] filtersDir?: string listsDir?: string showsDir?: string updatesDir?: string viewsDir?: string globIgnorePatterns?: string[] } export interface DependencyResolution { entry?: boolean deps: { [s: string]: string } file: string id: string source: string } export interface FunctionResolution extends DependencyResolution { output: string resolvedDeps: DependencyResolution[] path: string[] } export interface DesignDocument { _id: string language: string _rev?: string _attachments?: { [key: string]: Attachment } commons?: { [key: string]: string } views?: { lib?: { [key: string]: string } [key: string]: string | { [key: string]: string } } shows?: { [key: string]: string } lists?: { [key: string]: string } filters?: { [key: string]: string } updates?: { [key: string]: string } rewrites?: Rewrite[] } export interface Rewrite { from: string to: string method: string query: { [key: string]: string } }
export interface Attachment { id?: string content_type: string data: string } export interface CouchifyOptions { id?: string baseDocumentsDir?: string attachmentsDir?: string babelPlugins?: any[] babelPresets?: any[] filtersDir?: string listsDir?: string showsDir?: string updatesDir?: string viewsDir?: string globIgnorePatterns?: string[] } export interface DependencyResolution { entry?: boolean deps: { [s: string]: string } file: string id: string source: string } export interface FunctionResolution extends DependencyResolution { output: string resolvedDeps: DependencyResolution[] path: string[] } export interface DesignDocument { _id: string language: string _rev?: string _attachments?: { [key: string]: Attachment } commons?: { [key: string]: string } views?: { [key: string]: string | { [key: string]: string } } & { lib?: { [key: string]: string } } shows?: { [key: string]: string } lists?: { [key: string]: string } filters?: { [key: string]: string } updates?: { [key: string]: string } rewrites?: Rewrite[] } export interface Rewrite { from: string to: string method: string query: { [key: string]: string } }
Replace overload signature with union for TS-3.x compat
Replace overload signature with union for TS-3.x compat
TypeScript
mit
wearereasonablepeople/couchify,wearereasonablepeople/couchify
--- +++ @@ -39,9 +39,8 @@ _attachments?: { [key: string]: Attachment } commons?: { [key: string]: string } views?: { - lib?: { [key: string]: string } [key: string]: string | { [key: string]: string } - } + } & { lib?: { [key: string]: string } } shows?: { [key: string]: string } lists?: { [key: string]: string } filters?: { [key: string]: string }
72cc0ab8c76f26573399c713d8845f0110d6a044
pages/_app.tsx
pages/_app.tsx
import * as React from 'react' import App, { Container } from 'next/app'; import Head from 'next/head' import 'normalize.css/normalize.css' // A custom app to support importing CSS files globally class MyApp extends App { public render(): JSX.Element { const { Component, pageProps } = this.props return ( <Container> <Head> <meta name="viewport" content="width=device-width, initial-scale=1" /> </Head> <div> <Component {...pageProps} /> </div> <style jsx>{` div { width: 70vw; } `}</style> <style jsx global>{` body { display: flex; justify-content: center; align-items: center; background: black; color: white; } a { color: #ffcc00; } @media (prefers-color-scheme: light) { body { background: white; color: black; } a { color: #ff9500; } } `}</style> </Container> ) } } export default MyApp
import { Fragment } from 'react' import App, { Container } from 'next/app'; import Head from 'next/head' import 'normalize.css/normalize.css' // A custom app to support importing CSS files globally class MyApp extends App { public render(): JSX.Element { const { Component, pageProps } = this.props return ( <Fragment> <Head> <meta name="viewport" content="width=device-width, initial-scale=1" /> </Head> <div> <Component {...pageProps} /> </div> <style jsx>{` div { width: 70vw; } `}</style> <style jsx global>{` body { display: flex; justify-content: center; align-items: center; background: black; color: white; } a { color: #ffcc00; } @media (prefers-color-scheme: light) { body { background: white; color: black; } a { color: #ff9500; } } `}</style> </Fragment> ) } } export default MyApp
Replace deprecated Container with Fragment
Replace deprecated Container with Fragment
TypeScript
mit
JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk
--- +++ @@ -1,4 +1,4 @@ -import * as React from 'react' +import { Fragment } from 'react' import App, { Container } from 'next/app'; import Head from 'next/head' import 'normalize.css/normalize.css' @@ -9,7 +9,7 @@ public render(): JSX.Element { const { Component, pageProps } = this.props return ( - <Container> + <Fragment> <Head> <meta name="viewport" content="width=device-width, initial-scale=1" /> </Head> @@ -49,7 +49,7 @@ } } `}</style> - </Container> + </Fragment> ) }
e4088d2517f1d0dd07796c30a25cc646a0eb19ce
client/src/app/plants/bed.component.spec.ts
client/src/app/plants/bed.component.spec.ts
import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { Plant } from './plant'; import { PlantListService } from './plant-list.service'; import { Observable } from 'rxjs'; import { ActivatedRoute, Router } from '@angular/router'; import { FormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; import { BedComponent } from './bed.component'; import { GardenNavbarComponent } from '../navbar/garden-navbar.component'; import { FilterBy } from './filter.pipe'; describe("Bed component", () => { let bedComponent: BedComponent; let fixture: ComponentFixture<BedComponent>; let mockRouter: { events: Observable<any> }; let mockRoute: { snapshot: { params: { gardenLocation: string } } }; let plantListServiceStub: { getFlowersByBed: (string) => Observable<Plant[]>, }; beforeEach(() => { mockRouter = { events: Observable.of(null) }; mockRoute = { snapshot: { params: { "gardenLocation": "bestBed" } } }; plantListServiceStub = { getFlowersByBed: (bed: string) => Observable.of([ { _id: {$oid: "58daf99befbd607288f772a1"}, id: "16001", plantID: "16001", plantType: "", commonName: "commonName1", cultivar: "cultivar1", source: "", gardenLocation: "1N", year: 0, pageURL: "", plantImageURLs: [""], recognitions: [""] }, { _id: {$oid: "58daf99befbd607288f772a2"}, id: "16002", plantID: "16002", plantType: "", commonName: "commonName2", cultivar: "cultivar2", source: "", gardenLocation: "2N", year: 0, pageURL: "", plantImageURLs: [""], recognitions: [""] } ]), }; TestBed.configureTestingModule({ imports: [FormsModule, RouterTestingModule], declarations: [ BedComponent, GardenNavbarComponent, FilterBy ], providers: [ {provide: PlantListService, useValue: plantListServiceStub} , {provide: ActivatedRoute, useValue: mockRoute }, {provide: Router, useValue: mockRouter}] }); }); beforeEach( async(() => { TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(BedComponent); bedComponent = fixture.componentInstance; // fixture.detectChanges(); // doesn't work if this is uncommented }); })); it("can be initialized", () => { expect(bedComponent).toBeDefined(); expect("foo").toEqual("foo"); }); });
Create framework for testing BedComponent
Create framework for testing BedComponent
TypeScript
mit
UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner
--- +++ @@ -0,0 +1,99 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { Plant } from './plant'; +import { PlantListService } from './plant-list.service'; +import { Observable } from 'rxjs'; +import { ActivatedRoute, Router } from '@angular/router'; +import { FormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; +import { BedComponent } from './bed.component'; +import { GardenNavbarComponent } from '../navbar/garden-navbar.component'; +import { FilterBy } from './filter.pipe'; + +describe("Bed component", () => { + + let bedComponent: BedComponent; + let fixture: ComponentFixture<BedComponent>; + let mockRouter: { + events: Observable<any> + }; + let mockRoute: { + snapshot: { + params: { + gardenLocation: string + } + } + }; + let plantListServiceStub: { + getFlowersByBed: (string) => Observable<Plant[]>, + }; + + beforeEach(() => { + + mockRouter = { + events: Observable.of(null) + }; + mockRoute = { + snapshot: { + params: { + "gardenLocation": "bestBed" + } + } + }; + plantListServiceStub = { + getFlowersByBed: (bed: string) => Observable.of([ + { + _id: {$oid: "58daf99befbd607288f772a1"}, + id: "16001", + plantID: "16001", + plantType: "", + commonName: "commonName1", + cultivar: "cultivar1", + source: "", + gardenLocation: "1N", + year: 0, + pageURL: "", + plantImageURLs: [""], + recognitions: [""] + }, + { + _id: {$oid: "58daf99befbd607288f772a2"}, + id: "16002", + plantID: "16002", + plantType: "", + commonName: "commonName2", + cultivar: "cultivar2", + source: "", + gardenLocation: "2N", + year: 0, + pageURL: "", + plantImageURLs: [""], + recognitions: [""] + } + ]), + }; + + TestBed.configureTestingModule({ + imports: [FormsModule, RouterTestingModule], + declarations: [ BedComponent, GardenNavbarComponent, FilterBy ], + providers: [ + {provide: PlantListService, useValue: plantListServiceStub} , + {provide: ActivatedRoute, useValue: mockRoute }, + {provide: Router, useValue: mockRouter}] + }); + }); + + beforeEach( + async(() => { + TestBed.compileComponents().then(() => { + + fixture = TestBed.createComponent(BedComponent); + bedComponent = fixture.componentInstance; + // fixture.detectChanges(); // doesn't work if this is uncommented + }); + })); + + it("can be initialized", () => { + expect(bedComponent).toBeDefined(); + expect("foo").toEqual("foo"); + }); +});
6f5f7574798517cf61ea10f41d9a49fd10da74ad
extensions/markdown/src/commands/revealLine.ts
extensions/markdown/src/commands/revealLine.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { Command } from '../commandManager'; import { Logger } from '../logger'; import { isMarkdownFile } from '../features/previewContentProvider'; export class RevealLineCommand implements Command { public readonly id = '_markdown.revealLine'; public constructor( private logger: Logger ) { } public execute(uri: string, line: number) { const sourceUri = vscode.Uri.parse(decodeURIComponent(uri)); this.logger.log('revealLine', { uri, sourceUri: sourceUri.toString(), line }); vscode.window.visibleTextEditors .filter(editor => isMarkdownFile(editor.document) && editor.document.uri.toString() === sourceUri.toString()) .forEach(editor => { const sourceLine = Math.floor(line); const fraction = line - sourceLine; const text = editor.document.lineAt(sourceLine).text; const start = Math.floor(fraction * text.length); editor.revealRange( new vscode.Range(sourceLine, start, sourceLine + 1, 0), vscode.TextEditorRevealType.AtTop); }); } }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { Command } from '../commandManager'; import { Logger } from '../logger'; import { isMarkdownFile } from '../features/previewContentProvider'; export class RevealLineCommand implements Command { public readonly id = '_markdown.revealLine'; public constructor( private readonly logger: Logger ) { } public execute(uri: string, line: number) { const sourceUri = vscode.Uri.parse(decodeURIComponent(uri)); this.logger.log('revealLine', { uri, sourceUri: sourceUri.toString(), line }); vscode.window.visibleTextEditors .filter(editor => isMarkdownFile(editor.document) && editor.document.uri.fsPath === sourceUri.fsPath) .forEach(editor => { const sourceLine = Math.floor(line); const fraction = line - sourceLine; const text = editor.document.lineAt(sourceLine).text; const start = Math.floor(fraction * text.length); editor.revealRange( new vscode.Range(sourceLine, start, sourceLine + 1, 0), vscode.TextEditorRevealType.AtTop); }); } }
Use fspath for reveal line to fix drive letter case differences
Use fspath for reveal line to fix drive letter case differences
TypeScript
mit
rishii7/vscode,DustinCampbell/vscode,eamodio/vscode,microlv/vscode,landonepps/vscode,0xmohit/vscode,the-ress/vscode,cleidigh/vscode,mjbvz/vscode,microlv/vscode,eamodio/vscode,cleidigh/vscode,mjbvz/vscode,Microsoft/vscode,the-ress/vscode,hoovercj/vscode,joaomoreno/vscode,eamodio/vscode,cleidigh/vscode,Microsoft/vscode,mjbvz/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,microsoft/vscode,hoovercj/vscode,cleidigh/vscode,microlv/vscode,mjbvz/vscode,DustinCampbell/vscode,eamodio/vscode,joaomoreno/vscode,DustinCampbell/vscode,Microsoft/vscode,mjbvz/vscode,joaomoreno/vscode,eamodio/vscode,hoovercj/vscode,hoovercj/vscode,Microsoft/vscode,the-ress/vscode,mjbvz/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,0xmohit/vscode,mjbvz/vscode,microlv/vscode,microsoft/vscode,rishii7/vscode,rishii7/vscode,joaomoreno/vscode,cleidigh/vscode,microlv/vscode,mjbvz/vscode,rishii7/vscode,the-ress/vscode,eamodio/vscode,microlv/vscode,mjbvz/vscode,Microsoft/vscode,joaomoreno/vscode,DustinCampbell/vscode,cleidigh/vscode,rishii7/vscode,hoovercj/vscode,the-ress/vscode,0xmohit/vscode,DustinCampbell/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,rishii7/vscode,landonepps/vscode,mjbvz/vscode,0xmohit/vscode,landonepps/vscode,landonepps/vscode,microlv/vscode,0xmohit/vscode,landonepps/vscode,the-ress/vscode,Microsoft/vscode,microlv/vscode,landonepps/vscode,hoovercj/vscode,joaomoreno/vscode,hoovercj/vscode,microsoft/vscode,cleidigh/vscode,landonepps/vscode,Krzysztof-Cieslak/vscode,0xmohit/vscode,0xmohit/vscode,the-ress/vscode,microsoft/vscode,eamodio/vscode,rishii7/vscode,mjbvz/vscode,microlv/vscode,eamodio/vscode,rishii7/vscode,Microsoft/vscode,landonepps/vscode,Microsoft/vscode,cleidigh/vscode,microsoft/vscode,landonepps/vscode,DustinCampbell/vscode,joaomoreno/vscode,cleidigh/vscode,microsoft/vscode,joaomoreno/vscode,microlv/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,0xmohit/vscode,DustinCampbell/vscode,hoovercj/vscode,DustinCampbell/vscode,cleidigh/vscode,mjbvz/vscode,0xmohit/vscode,the-ress/vscode,rishii7/vscode,microlv/vscode,landonepps/vscode,DustinCampbell/vscode,rishii7/vscode,DustinCampbell/vscode,mjbvz/vscode,Microsoft/vscode,eamodio/vscode,hoovercj/vscode,mjbvz/vscode,landonepps/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,Microsoft/vscode,0xmohit/vscode,joaomoreno/vscode,Microsoft/vscode,microsoft/vscode,landonepps/vscode,DustinCampbell/vscode,hoovercj/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,eamodio/vscode,landonepps/vscode,rishii7/vscode,joaomoreno/vscode,the-ress/vscode,eamodio/vscode,microlv/vscode,0xmohit/vscode,eamodio/vscode,Microsoft/vscode,rishii7/vscode,landonepps/vscode,microsoft/vscode,rishii7/vscode,the-ress/vscode,cleidigh/vscode,microlv/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,Microsoft/vscode,landonepps/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,mjbvz/vscode,0xmohit/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,0xmohit/vscode,rishii7/vscode,the-ress/vscode,0xmohit/vscode,DustinCampbell/vscode,rishii7/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,landonepps/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,mjbvz/vscode,microsoft/vscode,hoovercj/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,rishii7/vscode,hoovercj/vscode,0xmohit/vscode,the-ress/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,Microsoft/vscode,microsoft/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,Microsoft/vscode,microlv/vscode,DustinCampbell/vscode,microlv/vscode,0xmohit/vscode,microsoft/vscode,cleidigh/vscode,DustinCampbell/vscode,eamodio/vscode,cleidigh/vscode,hoovercj/vscode,Microsoft/vscode,microlv/vscode,hoovercj/vscode,rishii7/vscode,microlv/vscode,cleidigh/vscode,0xmohit/vscode,DustinCampbell/vscode,eamodio/vscode,mjbvz/vscode,eamodio/vscode,the-ress/vscode
--- +++ @@ -12,7 +12,7 @@ public readonly id = '_markdown.revealLine'; public constructor( - private logger: Logger + private readonly logger: Logger ) { } public execute(uri: string, line: number) { @@ -20,7 +20,7 @@ this.logger.log('revealLine', { uri, sourceUri: sourceUri.toString(), line }); vscode.window.visibleTextEditors - .filter(editor => isMarkdownFile(editor.document) && editor.document.uri.toString() === sourceUri.toString()) + .filter(editor => isMarkdownFile(editor.document) && editor.document.uri.fsPath === sourceUri.fsPath) .forEach(editor => { const sourceLine = Math.floor(line); const fraction = line - sourceLine;
e20b24a50ccda660e5da09bf1dc99addc11de67b
src/animation/AnimationClip.d.ts
src/animation/AnimationClip.d.ts
import { KeyframeTrack } from './KeyframeTrack'; import { Bone } from './../objects/Bone'; import { MorphTarget } from '../core/Geometry'; import { AnimationBlendMode } from '../constants'; export class AnimationClip { constructor( name?: string, duration?: number, tracks?: KeyframeTrack[], blendMode?: AnimationBlendMode ); name: string; tracks: KeyframeTrack[]; /** * @default THREE.NormalAnimationBlendMode */ blendMode: AnimationBlendMode; /** * @default -1 */ duration: number; uuid: string; results: any[]; resetDuration(): AnimationClip; trim(): AnimationClip; validate(): boolean; optimize(): AnimationClip; clone(): AnimationClip; static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; static findByName( clipArray: AnimationClip[], name: string ): AnimationClip; static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[] ): AnimationClip; static toJSON(): any; }
import { KeyframeTrack } from './KeyframeTrack'; import { Bone } from './../objects/Bone'; import { MorphTarget } from '../core/Geometry'; import { AnimationBlendMode } from '../constants'; export class AnimationClip { constructor( name?: string, duration?: number, tracks?: KeyframeTrack[], blendMode?: AnimationBlendMode ); name: string; tracks: KeyframeTrack[]; /** * @default THREE.NormalAnimationBlendMode */ blendMode: AnimationBlendMode; /** * @default -1 */ duration: number; uuid: string; results: any[]; resetDuration(): AnimationClip; trim(): AnimationClip; validate(): boolean; optimize(): AnimationClip; clone(): AnimationClip; static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; static findByName( clipArray: AnimationClip[], name: string ): AnimationClip; static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[] ): AnimationClip; static toJSON( json: any): any; }
Fix PARAMETER ERROR of AnimationClip.toJSON()
Fix PARAMETER ERROR of AnimationClip.toJSON()
TypeScript
mit
mrdoob/three.js,kaisalmen/three.js,makc/three.js.fork,aardgoose/three.js,looeee/three.js,mrdoob/three.js,donmccurdy/three.js,donmccurdy/three.js,Liuer/three.js,jpweeks/three.js,aardgoose/three.js,06wj/three.js,jpweeks/three.js,WestLangley/three.js,gero3/three.js,greggman/three.js,WestLangley/three.js,kaisalmen/three.js,looeee/three.js,fyoudine/three.js,makc/three.js.fork,06wj/three.js,fyoudine/three.js,greggman/three.js,gero3/three.js,Liuer/three.js
--- +++ @@ -45,6 +45,6 @@ animation: any, bones: Bone[] ): AnimationClip; - static toJSON(): any; + static toJSON( json: any): any; }
23d24a47df06ba1efb26d63af7edbc52d36e4d56
src/join-arrays.ts
src/join-arrays.ts
import { cloneDeep, isFunction, isPlainObject, mergeWith } from "lodash"; import { Customize, Key } from "./types"; const isArray = Array.isArray; export default function joinArrays({ customizeArray, customizeObject, key, }: { customizeArray?: Customize; customizeObject?: Customize; key?: Key; } = {}) { return function _joinArrays(a: any, b: any, k: Key): any { const newKey = key ? `${key}.${k}` : k; if (isFunction(a) && isFunction(b)) { return (...args: any[]) => _joinArrays(a(...args), b(...args), k); } if (isArray(a) && isArray(b)) { const customResult = customizeArray && customizeArray(a, b, newKey); return customResult || [...a, ...b]; } if (isPlainObject(a) && isPlainObject(b)) { const customResult = customizeObject && customizeObject(a, b, newKey); return ( customResult || mergeWith( {}, a, b, joinArrays({ customizeArray, customizeObject, key: newKey, }) ) ); } if (isPlainObject(b)) { return cloneDeep(b); } if (isArray(b)) { return [...b]; } return b; }; }
import { cloneDeep, isPlainObject, mergeWith } from "lodash"; import { Customize, Key } from "./types"; const isArray = Array.isArray; export default function joinArrays({ customizeArray, customizeObject, key, }: { customizeArray?: Customize; customizeObject?: Customize; key?: Key; } = {}) { return function _joinArrays(a: any, b: any, k: Key): any { const newKey = key ? `${key}.${k}` : k; if (isFunction(a) && isFunction(b)) { return (...args: any[]) => _joinArrays(a(...args), b(...args), k); } if (isArray(a) && isArray(b)) { const customResult = customizeArray && customizeArray(a, b, newKey); return customResult || [...a, ...b]; } if (isPlainObject(a) && isPlainObject(b)) { const customResult = customizeObject && customizeObject(a, b, newKey); return ( customResult || mergeWith( {}, a, b, joinArrays({ customizeArray, customizeObject, key: newKey, }) ) ); } if (isPlainObject(b)) { return cloneDeep(b); } if (isArray(b)) { return [...b]; } return b; }; } // https://stackoverflow.com/a/7356528/228885 function isFunction(functionToCheck) { return ( functionToCheck && {}.toString.call(functionToCheck) === "[object Function]" ); }
Drop dependency on lodash isFunction
refactor: Drop dependency on lodash isFunction Related to #134.
TypeScript
mit
survivejs/webpack-merge,survivejs/webpack-merge
--- +++ @@ -1,4 +1,4 @@ -import { cloneDeep, isFunction, isPlainObject, mergeWith } from "lodash"; +import { cloneDeep, isPlainObject, mergeWith } from "lodash"; import { Customize, Key } from "./types"; const isArray = Array.isArray; @@ -53,3 +53,10 @@ return b; }; } + +// https://stackoverflow.com/a/7356528/228885 +function isFunction(functionToCheck) { + return ( + functionToCheck && {}.toString.call(functionToCheck) === "[object Function]" + ); +}
dc50bb0b6c4c7b370564920d0fe7942023187a3f
src/lib/Scenes/Map/__tests__/GlobalMap-tests.tsx
src/lib/Scenes/Map/__tests__/GlobalMap-tests.tsx
import { CityFixture } from "lib/__fixtures__/CityFixture" import { renderRelayTree } from "lib/tests/renderRelayTree" import { graphql } from "react-relay" import { GlobalMapContainer } from "../GlobalMap" jest.unmock("react-relay") jest.mock("@mapbox/react-native-mapbox-gl", () => ({ StyleSheet: { create: jest.fn(), identity: jest.fn(), source: jest.fn(), }, InterpolationMode: { Exponential: jest.fn(), }, MapView: jest.fn(), setAccessToken: jest.fn(), UserTrackingModes: jest.fn(), })) describe("GlobalMap", () => { it("renders correctly", async () => { await renderRelayTree({ componentProps: { safeAreaInsets: { top: 1, }, }, Component: GlobalMapContainer, query: graphql` query GlobalMapTestsQuery($citySlug: String!, $maxInt: Int!) { viewer { ...GlobalMap_viewer @arguments(citySlug: $citySlug, maxInt: $maxInt) } } `, mockData: { viewer: { city: CityFixture, }, }, variables: { citySlug: "new-york-ny-usa", maxInt: 42, }, }) }) })
import { CityFixture } from "lib/__fixtures__/CityFixture" import { renderRelayTree } from "lib/tests/renderRelayTree" import { graphql } from "react-relay" import { GlobalMapContainer } from "../GlobalMap" jest.unmock("react-relay") jest.mock("@mapbox/react-native-mapbox-gl", () => ({ StyleSheet: { create: jest.fn(), identity: jest.fn(), source: jest.fn(), }, InterpolationMode: { Exponential: jest.fn(), }, MapView: () => null, setAccessToken: jest.fn(), UserTrackingModes: jest.fn(), })) describe("GlobalMap", () => { it("renders correctly", async () => { await renderRelayTree({ componentProps: { safeAreaInsets: { top: 1, }, }, Component: GlobalMapContainer, query: graphql` query GlobalMapTestsQuery($citySlug: String!, $maxInt: Int!) { viewer { ...GlobalMap_viewer @arguments(citySlug: $citySlug, maxInt: $maxInt) } } `, mockData: { viewer: { city: CityFixture, }, }, variables: { citySlug: "new-york-ny-usa", maxInt: 42, }, }) }) })
Fix console log about a component not rendering anything
[test] Fix console log about a component not rendering anything
TypeScript
mit
artsy/emission,artsy/emission,artsy/eigen,artsy/eigen,artsy/emission,artsy/eigen,artsy/emission,artsy/eigen,artsy/eigen,artsy/emission,artsy/eigen,artsy/emission,artsy/eigen,artsy/emission
--- +++ @@ -13,7 +13,7 @@ InterpolationMode: { Exponential: jest.fn(), }, - MapView: jest.fn(), + MapView: () => null, setAccessToken: jest.fn(), UserTrackingModes: jest.fn(), }))
e4ef34614fbc21841db14900dc46cba4b3e47c3e
src/helper/logger.ts
src/helper/logger.ts
import appRoot from 'app-root-path'; import { createLogger, transports, format } from 'winston'; const { combine, timestamp, colorize } = format; // instantiate a new Winston Logger with the settings defined above const logger = createLogger({ transports: [ new (transports.Console)({ level: process.env.NODE_ENV === 'production' ? 'error' : 'debug', handleExceptions: true, format: combine( timestamp(), colorize(), format.simple(), ), }), ], exitOnError: false, }); export class LoggerStream { public name: string; public level: string; constructor(name: string, level?: string) { this.name = name; this.level = level || 'info'; } public write(message: string) { if (this.name) { logger.log(this.level, this.name + ' ' + message); } else { logger.info(this.level, message); } } } if (process.env.NODE_ENV === 'production') { logger.debug('Logging initialized at production level'); } else { logger.debug('Logging initialized at development level, set NODE_ENV === \'production\' for production use.'); } export default logger;
import appRoot from 'app-root-path'; import { createLogger, transports, format } from 'winston'; const { combine, timestamp, colorize } = format; // instantiate a new Winston Logger with the settings defined above const isProductionMode = process.env.NODE_ENV === 'production'; let level = 'debug'; let logFormat = combine( timestamp(), colorize(), format.simple(), ); if (isProductionMode) { level = 'error'; logFormat = combine( timestamp(), format.simple(), ); } const logger = createLogger({ transports: [ new (transports.Console)({ level, handleExceptions: true, format: logFormat, }), ], exitOnError: false, }); export class LoggerStream { public name: string; public level: string; constructor(name: string, level?: string) { this.name = name; this.level = level || 'info'; } public write(message: string) { if (this.name) { logger.log(this.level, this.name + ' ' + message); } else { logger.info(this.level, message); } } } if (isProductionMode) { console.log('Logging initialized at production level'); } else { logger.debug('Logging initialized at development level, set NODE_ENV === \'production\' for production use.'); } export default logger;
Remove color from production logs
Remove color from production logs
TypeScript
mit
schulcloud/node-notification-service,schulcloud/node-notification-service,schulcloud/node-notification-service
--- +++ @@ -4,16 +4,28 @@ // instantiate a new Winston Logger with the settings defined above +const isProductionMode = process.env.NODE_ENV === 'production'; + +let level = 'debug'; +let logFormat = combine( + timestamp(), + colorize(), + format.simple(), +); + +if (isProductionMode) { + level = 'error'; + logFormat = combine( + timestamp(), + format.simple(), + ); +} const logger = createLogger({ transports: [ new (transports.Console)({ - level: process.env.NODE_ENV === 'production' ? 'error' : 'debug', + level, handleExceptions: true, - format: combine( - timestamp(), - colorize(), - format.simple(), - ), + format: logFormat, }), ], exitOnError: false, @@ -36,8 +48,8 @@ } } -if (process.env.NODE_ENV === 'production') { - logger.debug('Logging initialized at production level'); +if (isProductionMode) { + console.log('Logging initialized at production level'); } else { logger.debug('Logging initialized at development level, set NODE_ENV === \'production\' for production use.'); }
3db0a1efbd280bf7bdc3f4600fdee87719708ed8
src/components/UISrefActive.tsx
src/components/UISrefActive.tsx
import {Component, PropTypes, cloneElement} from 'react'; import * as classNames from 'classnames'; import UIRouterReact, { UISref } from '../index'; import {find} from '../utils'; export class UISrefActive extends Component<any,any> { uiSref; static propTypes = { class: PropTypes.string.isRequired, children: PropTypes.element.isRequired } constructor (props) { super(props); } componentWillMount () { const child = this.props.children; this.uiSref = find(child, component => { return typeof component.type === 'function' && component.type.name === 'UISref'; }); } isActive = () => { let currentState = UIRouterReact.instance.globals.current.name; return this.uiSref && this.uiSref.props.to === currentState; } render () { let isActive = this.isActive(); return ( !isActive ? this.props.children : cloneElement(this.props.children, Object.assign({}, this.props.children.props, { className: classNames(this.props.children.props.className, this.props.class) })) ); } }
import {Component, PropTypes, cloneElement, ValidationMap} from 'react'; import * as classNames from 'classnames'; import UIRouterReact, { UISref } from '../index'; import {UIViewAddress} from "./UIView"; import {find} from '../utils'; export interface IProps { class?: string; children?: any; } export class UISrefActive extends Component<IProps,any> { uiSref; static propTypes = { class: PropTypes.string.isRequired, children: PropTypes.element.isRequired } static contextTypes: ValidationMap<any> = { parentUIViewAddress: PropTypes.object } componentWillMount () { const child = this.props.children; this.uiSref = find(child, component => { return typeof component.type === 'function' && component.type.name === 'UISref'; }); } isActive = () => { let parentUIViewAddress: UIViewAddress = this.context['parentUIViewAddress']; let {to, params} = this.uiSref.props, {stateService} = UIRouterReact.instance; let state = stateService.get(to, parentUIViewAddress.context) || { name: to }; return this.uiSref && (stateService.is(state.name, params) || stateService.includes(state.name, params)); } render () { let isActive = this.isActive(); return ( !isActive ? this.props.children : cloneElement(this.props.children, Object.assign({}, this.props.children.props, { className: classNames(this.props.children.props.className, this.props.class) })) ); } }
Support active state checking relative to parent UIView
fix(UISrefAcive): Support active state checking relative to parent UIView chore(UISrefActive): add Props typings (TS)
TypeScript
mit
ui-router/react,ui-router/react
--- +++ @@ -1,9 +1,15 @@ -import {Component, PropTypes, cloneElement} from 'react'; +import {Component, PropTypes, cloneElement, ValidationMap} from 'react'; import * as classNames from 'classnames'; import UIRouterReact, { UISref } from '../index'; +import {UIViewAddress} from "./UIView"; import {find} from '../utils'; -export class UISrefActive extends Component<any,any> { +export interface IProps { + class?: string; + children?: any; +} + +export class UISrefActive extends Component<IProps,any> { uiSref; static propTypes = { @@ -11,8 +17,8 @@ children: PropTypes.element.isRequired } - constructor (props) { - super(props); + static contextTypes: ValidationMap<any> = { + parentUIViewAddress: PropTypes.object } componentWillMount () { @@ -23,8 +29,10 @@ } isActive = () => { - let currentState = UIRouterReact.instance.globals.current.name; - return this.uiSref && this.uiSref.props.to === currentState; + let parentUIViewAddress: UIViewAddress = this.context['parentUIViewAddress']; + let {to, params} = this.uiSref.props, {stateService} = UIRouterReact.instance; + let state = stateService.get(to, parentUIViewAddress.context) || { name: to }; + return this.uiSref && (stateService.is(state.name, params) || stateService.includes(state.name, params)); } render () {
8ec886ef728c40162a5ef812aadbd2424333705b
src/fe/components/PathDetailDisplay/PrerequisiteBox/FundBox.tsx
src/fe/components/PathDetailDisplay/PrerequisiteBox/FundBox.tsx
import * as React from 'react' import data from '../../../../data' import {FundPrereq} from "../../../../definitions/Prerequisites/FundPrereq" function stringifyCondition(condition: any) { if (condition.familyMember) { return ` if you have ${condition.familyMember} family members` } } const FundBox = (props: {prereq: FundPrereq}) => { if (props.prereq.type === "possess") { return ( <div> You have { props.prereq.schemes.map((scheme, index) => <div key={index}> {data.common.currencies[scheme.fund.currencyId].code} {" "} {scheme.fund.value} { scheme.condition && stringifyCondition(scheme.condition) } </div> ) } </div> ) } else { return <noscript /> } } export default FundBox
import * as React from 'react' import data from '../../../../data' import {FundPrereq} from "../../../../definitions/Prerequisites/FundPrereq" function stringifyCondition(condition: any) { if (condition.familyMember) { return ` if you have ${condition.familyMember} family members` } } const FundBox = (props: {prereq: FundPrereq}) => { if (props.prereq.type === "possess") { return ( <div> You have { props.prereq.schemes.map((scheme, index) => <div key={index}> {data.common.currencies[scheme.fund.currencyId].code} {" "} {scheme.fund.value.toLocaleString(data.app.lang, { style: "decimal", currency: scheme.fund.currencyId })} { scheme.condition && stringifyCondition(scheme.condition) } </div> ) } </div> ) } else { return <noscript /> } } export default FundBox
Add commata to currency numbers
Add commata to currency numbers Signed-off-by: Andy Shu <[email protected]>
TypeScript
agpl-3.0
wikimigrate/wikimigrate,wikimigrate/wikimigrate,wikimigrate/wikimigrate,wikimigrate/wikimigrate
--- +++ @@ -19,7 +19,10 @@ <div key={index}> {data.common.currencies[scheme.fund.currencyId].code} {" "} - {scheme.fund.value} + {scheme.fund.value.toLocaleString(data.app.lang, { + style: "decimal", + currency: scheme.fund.currencyId + })} { scheme.condition && stringifyCondition(scheme.condition) }
ba54f7db4ec57d4b30cd8f3cfd9dea27dcaa74cb
test/test_index.ts
test/test_index.ts
process.env.FRONTEND_URL = "dummy" process.env.SESSION_SECRET = "dummy" process.env.TWITTER_CONSUMER_KEY = "dummy" process.env.TWITTER_CONSUMER_SECRET = "dummy" process.env.TWITTER_CALLBACK_URL = "dummy" import * as request from "supertest" import "../server/index" import * as net from 'net' describe("index", () => { it("start server listening at port 8080", done => { let client = net.connect({port: 8080}, () => { done() client.end() }) }) })
process.env.PORT = 9090 process.env.FRONTEND_URL = "dummy" process.env.SESSION_SECRET = "dummy" process.env.TWITTER_CONSUMER_KEY = "dummy" process.env.TWITTER_CONSUMER_SECRET = "dummy" process.env.TWITTER_CALLBACK_URL = "dummy" import * as request from "supertest" import "../server/index" import * as net from 'net' describe("index", () => { it("start server listening at port 9090", done => { let client = net.connect({port: 9090}, () => { done() client.end() }) }) })
Use port 9090 on test
Use port 9090 on test
TypeScript
mit
sketchglass/respass,sketchglass/respass,sketchglass/respass,sketchglass/respass
--- +++ @@ -1,3 +1,4 @@ +process.env.PORT = 9090 process.env.FRONTEND_URL = "dummy" process.env.SESSION_SECRET = "dummy" process.env.TWITTER_CONSUMER_KEY = "dummy" @@ -9,8 +10,8 @@ import * as net from 'net' describe("index", () => { - it("start server listening at port 8080", done => { - let client = net.connect({port: 8080}, () => { + it("start server listening at port 9090", done => { + let client = net.connect({port: 9090}, () => { done() client.end() })
5f28d53065dcde600c5385297849ef4cfaaa8717
src/notCommand.ts
src/notCommand.ts
import * as vsc from 'vscode' import * as ts from 'typescript' import { invertExpression } from './utils/invert-expression' export const NOT_COMMAND = 'complete.notTemplate' export function notCommand (editor: vsc.TextEditor, position: vsc.Position, suffix: string, expressions: ts.BinaryExpression[]) { return vsc.window.showQuickPick(expressions.map(node => ({ label: node.getText(), description: '', detail: 'Invert this expression', node: node }))) .then(value => { if (!value) { return undefined } editor.edit(e => { const expressionBody = value.node.getText() const startPos = new vsc.Position(position.line, position.character - expressionBody.length - suffix.length) const range = new vsc.Range(startPos, new vsc.Position(position.line, position.character - suffix.length + 1)) e.replace(range, invertExpression(value.node)) }) }) }
import * as vsc from 'vscode' import * as ts from 'typescript' import { invertExpression } from './utils/invert-expression' export const NOT_COMMAND = 'complete.notTemplate' export function notCommand(editor: vsc.TextEditor, position: vsc.Position, suffix: string, expressions: ts.BinaryExpression[]) { return vsc.window.showQuickPick(expressions.map(node => ({ label: node.getText(), description: '', detail: 'Invert this expression', node: node }))) .then(value => { if (!value) { return undefined } editor.edit(e => { const node = value.node const src = node.getSourceFile() const nodeStart = ts.getLineAndCharacterOfPosition(src, node.getStart(src)) const nodeEnd = ts.getLineAndCharacterOfPosition(src, node.getEnd()) const range = new vsc.Range( new vsc.Position(nodeStart.line, nodeStart.character), new vsc.Position(nodeEnd.line, nodeEnd.character + 1) // accomodate 1 character for the dot ) e.replace(range, invertExpression(value.node)) }) }) }
Fix error when calling .not command for complex multiline expressions
Fix error when calling .not command for complex multiline expressions Range was still being calculated using the old way instead of node location
TypeScript
mit
ipatalas/vscode-postfix-ts,ipatalas/vscode-postfix-ts
--- +++ @@ -4,7 +4,7 @@ export const NOT_COMMAND = 'complete.notTemplate' -export function notCommand (editor: vsc.TextEditor, position: vsc.Position, suffix: string, expressions: ts.BinaryExpression[]) { +export function notCommand(editor: vsc.TextEditor, position: vsc.Position, suffix: string, expressions: ts.BinaryExpression[]) { return vsc.window.showQuickPick(expressions.map(node => ({ label: node.getText(), description: '', @@ -17,9 +17,16 @@ } editor.edit(e => { - const expressionBody = value.node.getText() - const startPos = new vsc.Position(position.line, position.character - expressionBody.length - suffix.length) - const range = new vsc.Range(startPos, new vsc.Position(position.line, position.character - suffix.length + 1)) + const node = value.node + + const src = node.getSourceFile() + const nodeStart = ts.getLineAndCharacterOfPosition(src, node.getStart(src)) + const nodeEnd = ts.getLineAndCharacterOfPosition(src, node.getEnd()) + + const range = new vsc.Range( + new vsc.Position(nodeStart.line, nodeStart.character), + new vsc.Position(nodeEnd.line, nodeEnd.character + 1) // accomodate 1 character for the dot + ) e.replace(range, invertExpression(value.node)) })
5817d881e9d43855e7efe092ffa033d771a0c2b0
app/shared/object.ts
app/shared/object.ts
import { Field } from './field'; import { File } from './file'; export class Object{ id: number; base_path: string; input_file: string; path: string; title: string; headers: string[]; metadata: Field[]; files: File[]; metadataHash: string; productionNotes: string; getField(name: string): Field { return this.metadata.find(field => name === field.name); } getFieldValue(name: string): string { let field: Field = this.getField(name); if (!field) { return null; } field.joinValues(); return field.value; } isGood(): boolean { let requiredMetadata: Field[] = this.metadata.filter((metadata) => { return ( metadata.map && metadata.map.obligation === 'required' && metadata.value === '' && !metadata.map.hidden); }); return requiredMetadata.length === 0; } }
import { Field } from './field'; import { File } from './file'; export class Object{ id: number; base_path: string; input_file: string; path: string; title: string; headers: string[]; metadata: Field[]; files: File[]; metadataHash: string; productionNotes: string; getField(name: string): Field { return this.metadata.find(field => name === field.name); } getFieldValue(name: string): string { let field: Field = this.getField(name); if (!field) { return null; } field.joinValues(); return field.value; } isGood(): boolean { let requiredMetadata: Field[] = this.metadata.filter((metadata) => { return ( metadata.map && metadata.map.obligation === 'required' && metadata.value === '' && metadata.map.visible); }); return requiredMetadata.length === 0; } }
Fix error in validation check
Fix error in validation check
TypeScript
mit
uhlibraries-digital/brays,uhlibraries-digital/brays,uhlibraries-digital/brays
--- +++ @@ -30,7 +30,7 @@ metadata.map && metadata.map.obligation === 'required' && metadata.value === '' && - !metadata.map.hidden); + metadata.map.visible); }); return requiredMetadata.length === 0;
8ca694689acdfd5e0ca681c4e8975a89a535daef
src/ng-chat/core/group.ts
src/ng-chat/core/group.ts
import { Guid } from "./guid"; import { User } from "./user"; import { ChatParticipantStatus } from "./chat-participant-status.enum"; import { IChatParticipant } from "./chat-participant"; import { ChatParticipantType } from "./chat-participant-type.enum"; export class Group implements IChatParticipant { constructor(participants: User[], currentUserDisplayName: string) { this.chattingTo = participants; this.status = ChatParticipantStatus.Online; // TODO: Add some customization for this in future releases this.displayName = participants.map((p) => p.displayName).sort((first, second) => second > first ? -1 : 1).join(", "); } public id: string = Guid.newGuid(); public chattingTo: User[]; public readonly participantType: ChatParticipantType = ChatParticipantType.Group; public status: ChatParticipantStatus; public avatar: string | null; public displayName: string; }
import { Guid } from "./guid"; import { User } from "./user"; import { ChatParticipantStatus } from "./chat-participant-status.enum"; import { IChatParticipant } from "./chat-participant"; import { ChatParticipantType } from "./chat-participant-type.enum"; export class Group implements IChatParticipant { constructor(participants: User[]) { this.chattingTo = participants; this.status = ChatParticipantStatus.Online; // TODO: Add some customization for this in future releases this.displayName = participants.map((p) => p.displayName).sort((first, second) => second > first ? -1 : 1).join(", "); } public id: string = Guid.newGuid(); public chattingTo: User[]; public readonly participantType: ChatParticipantType = ChatParticipantType.Group; public status: ChatParticipantStatus; public avatar: string | null; public displayName: string; }
Remove unnecessary additional constructor argument on Group class
Remove unnecessary additional constructor argument on Group class
TypeScript
mit
rpaschoal/ng-chat,rpaschoal/ng-chat,rpaschoal/ng-chat
--- +++ @@ -6,7 +6,7 @@ export class Group implements IChatParticipant { - constructor(participants: User[], currentUserDisplayName: string) + constructor(participants: User[]) { this.chattingTo = participants; this.status = ChatParticipantStatus.Online;
537d48ef943bfb6dd0dd9996eee5a7c8c0ac3f79
src/main/js/formatter/number.ts
src/main/js/formatter/number.ts
import {Formatter} from './formatter'; /** * @hidden */ export class NumberFormatter implements Formatter<number> { private digits_: number; constructor(digits: number) { this.digits_ = digits; } get digits(): number { return this.digits_; } public format(value: number): string { return value.toFixed(this.digits_); } }
import {Formatter} from './formatter'; /** * @hidden */ export class NumberFormatter implements Formatter<number> { private digits_: number; constructor(digits: number) { this.digits_ = digits; } get digits(): number { return this.digits_; } public format(value: number): string { return value.toFixed(Math.max(Math.min(this.digits_, 20), 0)); } }
Fix error on Safari: toFixed() argument must be between 0 and 20
Fix error on Safari: toFixed() argument must be between 0 and 20
TypeScript
mit
cocopon/tweakpane,cocopon/tweakpane,cocopon/tweakpane
--- +++ @@ -15,6 +15,6 @@ } public format(value: number): string { - return value.toFixed(this.digits_); + return value.toFixed(Math.max(Math.min(this.digits_, 20), 0)); } }
46df7c93a66b315fdd7807124b4fb64a1640188e
src/routes.tsx
src/routes.tsx
import { RouteConfig } from "react-router-config"; import Layout from "./components/Layout"; import GitHubSearchLayout from "./example/components/GitHubSearchLayout"; import Main from "./example/components/Main"; import About from "./example/components/About"; const routeConfig: RouteConfig[] = [ { component: Layout, routes: [{ component: GitHubSearchLayout, routes: [{ component: About, path: "/about" }, { component: Main, }] }] } ]; export default routeConfig;
import { RouteConfig } from "react-router-config"; import Layout from "./components/Layout"; import GitHubSearchLayout from "./example/components/GitHubSearchLayout"; import Main from "./example/components/Main"; import About from "./example/components/About"; const routeConfig: RouteConfig[] = [ { component: Layout, routes: [{ component: GitHubSearchLayout, routes: [{ component: About, path: "/about" }, { component: Main, path: "/:username?" }] }] } ]; export default routeConfig;
Add username param to user search route
Add username param to user search route
TypeScript
mit
lith-light-g/universal-react-redux-typescript-starter-kit,lith-light-g/universal-react-redux-typescript-starter-kit
--- +++ @@ -14,6 +14,7 @@ path: "/about" }, { component: Main, + path: "/:username?" }] }] }
cce77e22eb4e32bfd19f593b6c4286e209988558
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.0', RELEASEVERSION: '0.15.0' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.1', RELEASEVERSION: '0.15.1' }; export = BaseConfig;
Update release version to 0.15.1.
Update release version to 0.15.1.
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.0', - RELEASEVERSION: '0.15.0' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.1', + RELEASEVERSION: '0.15.1' }; export = BaseConfig;
f5d97f4fedc941255ab98da3a52411f6d6f70c5f
tools/env/prod.ts
tools/env/prod.ts
import {EnvConfig} from './env-config.interface'; const ProdConfig: EnvConfig = { ENV: 'PROD', API: 'https://ne8nefmm61.execute-api.us-east-1.amazonaws.com/v1', AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv' }; export = ProdConfig;
import {EnvConfig} from './env-config.interface'; const ProdConfig: EnvConfig = { ENV: 'PROD', API: 'https://ne8nefmm61.execute-api.us-east-1.amazonaws.com/v1', AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv', GOOGLE_CLIENT_ID: '733735566798-5ob9fijml9fsf43tfvi26iong72r954u.apps.googleusercontent.com', NOTIFICATION_WS: 'ws://messaging.alpha.formig.io:8081' }; export = ProdConfig;
Add in Prod Alpha Endpoints
Add in Prod Alpha Endpoints
TypeScript
mit
formigio/angular-frontend,formigio/angular-frontend,formigio/angular-frontend
--- +++ @@ -6,7 +6,9 @@ AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', - COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv' + COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv', + GOOGLE_CLIENT_ID: '733735566798-5ob9fijml9fsf43tfvi26iong72r954u.apps.googleusercontent.com', + NOTIFICATION_WS: 'ws://messaging.alpha.formig.io:8081' }; export = ProdConfig;
a604ae51d4d3aeedcf8036971818146a5595642b
front_end/sdk/SharedArrayBufferTransferIssue.ts
front_end/sdk/SharedArrayBufferTransferIssue.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {ls} from '../common/common.js'; // eslint-disable-line rulesdir/es_modules_import import {Issue, IssueCategory, IssueKind, MarkdownIssueDescription} from './Issue.js'; // eslint-disable-line no-unused-vars import {IssuesModel} from './IssuesModel.js'; // eslint-disable-line no-unused-vars export class SharedArrayBufferTransferIssue extends Issue { private issueDetails: Protocol.Audits.SharedArrayBufferTransferIssueDetails; constructor(issueDetails: Protocol.Audits.SharedArrayBufferTransferIssueDetails, issuesModel: IssuesModel) { super(Protocol.Audits.InspectorIssueCode.SharedArrayBufferTransferIssue, issuesModel); this.issueDetails = issueDetails; } getCategory(): IssueCategory { return IssueCategory.Other; } sharedArrayBufferTransfers(): Protocol.Audits.SharedArrayBufferTransferIssueDetails[] { return [this.issueDetails]; } details(): Protocol.Audits.SharedArrayBufferTransferIssueDetails { return this.issueDetails; } getDescription(): MarkdownIssueDescription { return { file: 'issues/descriptions/sharedArrayBufferTransfer.md', substitutions: undefined, issueKind: IssueKind.BreakingChange, links: [{link: 'https://web.dev/enabling-shared-array-buffer/', linkTitle: ls`Enabling Shared Array Buffer`}], }; } primaryKey(): string { return JSON.stringify(this.issueDetails); } }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {ls} from '../common/common.js'; // eslint-disable-line rulesdir/es_modules_import import {Issue, IssueCategory, IssueKind, MarkdownIssueDescription} from './Issue.js'; // eslint-disable-line no-unused-vars import {IssuesModel} from './IssuesModel.js'; // eslint-disable-line no-unused-vars export class SharedArrayBufferTransferIssue extends Issue { private issueDetails: Protocol.Audits.SharedArrayBufferTransferIssueDetails; constructor(issueDetails: Protocol.Audits.SharedArrayBufferTransferIssueDetails, issuesModel: IssuesModel) { super(Protocol.Audits.InspectorIssueCode.SharedArrayBufferTransferIssue, issuesModel); this.issueDetails = issueDetails; } getCategory(): IssueCategory { return IssueCategory.Other; } sharedArrayBufferTransfers(): Protocol.Audits.SharedArrayBufferTransferIssueDetails[] { return [this.issueDetails]; } details(): Protocol.Audits.SharedArrayBufferTransferIssueDetails { return this.issueDetails; } getDescription(): MarkdownIssueDescription { return { file: 'issues/descriptions/sharedArrayBufferTransfer.md', substitutions: undefined, issueKind: IssueKind.BreakingChange, links: [{ link: 'https://developer.chrome.com/blog/enabling-shared-array-buffer/', linkTitle: ls`Enabling Shared Array Buffer`, }], }; } primaryKey(): string { return JSON.stringify(this.issueDetails); } }
Update link for SAB usage
Update link for SAB usage Bug: chromium:1051466 Change-Id: I763a78101cd1b397b3b1eb7176ca359821623fac Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2637619 Reviewed-by: Wolfgang Beyer <[email protected]> Commit-Queue: Sigurd Schneider <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -32,7 +32,10 @@ file: 'issues/descriptions/sharedArrayBufferTransfer.md', substitutions: undefined, issueKind: IssueKind.BreakingChange, - links: [{link: 'https://web.dev/enabling-shared-array-buffer/', linkTitle: ls`Enabling Shared Array Buffer`}], + links: [{ + link: 'https://developer.chrome.com/blog/enabling-shared-array-buffer/', + linkTitle: ls`Enabling Shared Array Buffer`, + }], }; }
2432a135e948cb869aba5edb044f8f06745f2026
packages/components/components/toolbar/ToolbarButton.tsx
packages/components/components/toolbar/ToolbarButton.tsx
import React, { ButtonHTMLAttributes, ReactNode } from 'react'; import { classnames } from '../../helpers/component'; import Icon, { Props as IconProps } from '../icon/Icon'; import { noop } from 'proton-shared/lib/helpers/function'; import { Tooltip } from '../..'; interface Props extends ButtonHTMLAttributes<HTMLButtonElement> { icon: string | IconProps; children?: ReactNode; } const ToolbarButton = React.forwardRef<HTMLButtonElement, Props>( ({ icon, children, className, disabled, tabIndex, title, onClick, ...rest }: Props, ref) => { const content = ( <button type="button" className={classnames([className, 'toolbar-button'])} onClick={disabled ? noop : onClick} tabIndex={disabled ? -1 : tabIndex} disabled={disabled} ref={ref} {...rest} > {typeof icon === 'string' ? ( <Icon name={icon} className="toolbar-icon mauto" /> ) : ( <Icon {...icon} className={classnames([icon.className, 'toolbar-icon mauto'])} /> )} {children} </button> ); return title ? ( <Tooltip title={title} className="flex flex-item-noshrink"> {content} </Tooltip> ) : ( content ); } ); export default ToolbarButton;
import React, { ButtonHTMLAttributes, ReactNode } from 'react'; import { classnames } from '../../helpers/component'; import Icon, { Props as IconProps } from '../icon/Icon'; import { noop } from 'proton-shared/lib/helpers/function'; import { Tooltip } from '../..'; interface Props extends ButtonHTMLAttributes<HTMLButtonElement> { icon: string | IconProps; children?: ReactNode; } const ToolbarButton = React.forwardRef<HTMLButtonElement, Props>( ({ icon, children, className, disabled, tabIndex, title, onClick, ...rest }: Props, ref) => { const content = ( <button type="button" className={classnames([className, 'toolbar-button'])} onClick={disabled ? noop : onClick} tabIndex={disabled ? -1 : tabIndex} disabled={disabled} ref={ref} {...rest} > {typeof icon === 'string' ? ( <Icon alt={title} name={icon} className="toolbar-icon mauto" /> ) : ( <Icon alt={title} {...icon} className={classnames([icon.className, 'toolbar-icon mauto'])} /> )} {children} </button> ); return title ? ( <Tooltip title={title} className="flex flex-item-noshrink"> {content} </Tooltip> ) : ( content ); } ); export default ToolbarButton;
Add Alt text to toolbar button icon
Add Alt text to toolbar button icon
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -22,9 +22,9 @@ {...rest} > {typeof icon === 'string' ? ( - <Icon name={icon} className="toolbar-icon mauto" /> + <Icon alt={title} name={icon} className="toolbar-icon mauto" /> ) : ( - <Icon {...icon} className={classnames([icon.className, 'toolbar-icon mauto'])} /> + <Icon alt={title} {...icon} className={classnames([icon.className, 'toolbar-icon mauto'])} /> )} {children} </button>
b1e11d8d6921ec937580eb0ccd2cee7fa8e3f534
utils/get-city.ts
utils/get-city.ts
export default function getCity(address: any, name: string) { for (let prop of ['city', 'town', 'village', 'hamlet']) { if (address.hasOwnProperty(prop)) return address[prop]; } return name; };
export default function getCity(address: any, name: string) { for (let prop of ['city', 'town', 'village', 'hamlet', 'county']) { if (address.hasOwnProperty(prop)) return address[prop]; } return name; };
Return county if city not found
Return county if city not found
TypeScript
mit
chat-radar/chat-radar,chat-radar/chat-radar,chat-radar/chat-radar
--- +++ @@ -1,5 +1,5 @@ export default function getCity(address: any, name: string) { - for (let prop of ['city', 'town', 'village', 'hamlet']) { + for (let prop of ['city', 'town', 'village', 'hamlet', 'county']) { if (address.hasOwnProperty(prop)) return address[prop]; }
9ce3f9fd2e35d33ed4900522a612a324480bfd3d
web/resources/js/hello.ts
web/resources/js/hello.ts
import $ from "jquery"; document.addEventListener('DOMContentLoaded', () => {console.log("This is running TypeScript!")}) $(function () { $('[data-toggle="tooltip"]').tooltip() }); interface User { foo: string, bar: symbol, } export function foo(u: User): string | null { return document.getElementsByTagName('div').length % 2 ? "fooo" : null; }
import $ from "jquery"; document.addEventListener('DOMContentLoaded', () => {console.log("This is running TypeScript!")}) $(function () { $('[data-toggle="tooltip"]').tooltip() });
Revert "Play around with typescript a bit"
Revert "Play around with typescript a bit" This reverts commit 77cf995e4dad158d551081d3164bfb48b44ee452.
TypeScript
apache-2.0
agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft
--- +++ @@ -5,14 +5,3 @@ $(function () { $('[data-toggle="tooltip"]').tooltip() }); - -interface User { - foo: string, - bar: symbol, -} - -export function foo(u: User): string | null { - return document.getElementsByTagName('div').length % 2 - ? "fooo" - : null; -}
5a63d21f0b8d226802ba9168c1a76b83f187d05f
capstone-project/src/main/angular-webapp/src/app/authentication/authentication.component.ts
capstone-project/src/main/angular-webapp/src/app/authentication/authentication.component.ts
import { Component, OnInit } from '@angular/core'; import { SocialAuthService } from "angularx-social-login"; import { GoogleLoginProvider } from "angularx-social-login"; import { SocialUser } from "angularx-social-login"; @Component({ selector: 'app-authentication', templateUrl: './authentication.component.html', styleUrls: ['./authentication.component.css'] }) export class AuthenticationComponent implements OnInit { private user: SocialUser; constructor(private authService: SocialAuthService) { } ngOnInit(): void { this.authService.authState.subscribe((user) => { this.user = user; }); } signInWithGoogle(): void { this.authService.signIn(GoogleLoginProvider.PROVIDER_ID); } signOut(): void { this.authService.signOut(); } }
import { Component, OnInit } from '@angular/core'; import { SocialAuthService } from "angularx-social-login"; import { GoogleLoginProvider } from "angularx-social-login"; import { SocialUser } from "angularx-social-login"; @Component({ selector: 'app-authentication', templateUrl: './authentication.component.html', styleUrls: ['./authentication.component.css'] }) export class AuthenticationComponent implements OnInit { user: SocialUser; constructor(private authService: SocialAuthService) { } ngOnInit(): void { this.authService.authState.subscribe((user) => { this.user = user; }); } signInWithGoogle(): void { this.authService.signIn(GoogleLoginProvider.PROVIDER_ID); } signOut(): void { this.authService.signOut(); } }
Change back user field visibility (cannot be private because we use it in template)
Change back user field visibility (cannot be private because we use it in template)
TypeScript
apache-2.0
googleinterns/step263-2020,googleinterns/step263-2020,googleinterns/step263-2020,googleinterns/step263-2020
--- +++ @@ -10,7 +10,7 @@ }) export class AuthenticationComponent implements OnInit { - private user: SocialUser; + user: SocialUser; constructor(private authService: SocialAuthService) { }
f3f9992aea6c7008a2cf8b675b501edf18bc03a7
src/app/leaflet-map.service.spec.ts
src/app/leaflet-map.service.spec.ts
/* tslint:disable:no-unused-variable */ /*! * Leaflet Map Service * * Copyright(c) Exequiel Ceasar Navarrete <[email protected]> * Licensed under MIT */ import { TestBed, async, inject } from '@angular/core/testing'; import { LeafletMapService } from './leaflet-map.service'; describe('Service: LeafletMap', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [LeafletMapService] }); }); it('should instantiate the service', inject([LeafletMapService], (service: LeafletMapService) => { expect(service).toBeTruthy(); })); });
/* tslint:disable:no-unused-variable */ /*! * Leaflet Map Service * * Copyright(c) Exequiel Ceasar Navarrete <[email protected]> * Licensed under MIT */ import { TestBed, async, inject } from '@angular/core/testing'; import { Map, TileLayer } from 'leaflet'; import { LeafletMapService } from './leaflet-map.service'; describe('Service: LeafletMap', () => { let el: HTMLElement; beforeEach(() => { TestBed.configureTestingModule({ providers: [LeafletMapService] }); // create mock element needed for creating map el = document.createElement('div'); document.body.appendChild(el); }); it('should instantiate the service', inject([LeafletMapService], (service: LeafletMapService) => { expect(service).toBeTruthy(); })); it('should create map', async(inject([LeafletMapService], (service: LeafletMapService) => { service.createMap(el, {}); service.getMap().then((map: Map) => { expect(map).toBeTruthy(); }); }))); it('should add base tilelayer', async(inject([LeafletMapService], (service: LeafletMapService) => { service .addNewTileLayer('test-tile-layer', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data &copy; <a href="http://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors' }) .then((layer: TileLayer) => { expect(layer).toBeTruthy(); }) ; }))); it('should clear all tile layers', async(inject([LeafletMapService], (service: LeafletMapService) => { service .clearTileLayers() .then(() => { return service.getTileLayers() }) .then((layers: any) => { let keys = Object.keys(layers); expect(keys).toEqual(0); }) ; }))); afterEach(inject([LeafletMapService], (service: LeafletMapService) => { service.getMap().then((map: Map) => { // remove the map map.remove(); // remove mock element after execution el.remove(); }); })); });
Add new tests for leaflet map service
Add new tests for leaflet map service
TypeScript
mit
ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps
--- +++ @@ -8,20 +8,69 @@ */ import { TestBed, async, inject } from '@angular/core/testing'; +import { Map, TileLayer } from 'leaflet'; import { LeafletMapService } from './leaflet-map.service'; describe('Service: LeafletMap', () => { + let el: HTMLElement; beforeEach(() => { TestBed.configureTestingModule({ providers: [LeafletMapService] }); + + // create mock element needed for creating map + el = document.createElement('div'); + document.body.appendChild(el); }); it('should instantiate the service', inject([LeafletMapService], (service: LeafletMapService) => { expect(service).toBeTruthy(); })); + it('should create map', async(inject([LeafletMapService], (service: LeafletMapService) => { + service.createMap(el, {}); + + service.getMap().then((map: Map) => { + expect(map).toBeTruthy(); + }); + }))); + + it('should add base tilelayer', async(inject([LeafletMapService], (service: LeafletMapService) => { + service + .addNewTileLayer('test-tile-layer', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: 'Map data &copy; <a href="http://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors' + }) + .then((layer: TileLayer) => { + expect(layer).toBeTruthy(); + }) + ; + }))); + + it('should clear all tile layers', async(inject([LeafletMapService], (service: LeafletMapService) => { + service + .clearTileLayers() + .then(() => { + return service.getTileLayers() + }) + .then((layers: any) => { + let keys = Object.keys(layers); + + expect(keys).toEqual(0); + }) + ; + }))); + + afterEach(inject([LeafletMapService], (service: LeafletMapService) => { + service.getMap().then((map: Map) => { + // remove the map + map.remove(); + + // remove mock element after execution + el.remove(); + }); + })); + });
6038306e0b7e5f2ac2b7fdf8c96b99137055cdce
gui/executionGraphGui/client/libs/graph/src/components/graph/graph.component.spec.ts
gui/executionGraphGui/client/libs/graph/src/components/graph/graph.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { GraphComponent } from './graph.component'; describe('GraphComponent', () => { let component: GraphComponent; let fixture: ComponentFixture<GraphComponent>; beforeEach( async(() => { TestBed.configureTestingModule({ declarations: [GraphComponent] }).compileComponents(); }) ); beforeEach(() => { fixture = TestBed.createComponent(GraphComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should throw when adding a connection to an inexistant port', () => { expect(() => component.registerConnection('foo', 'bar')).toThrow(); }) });
import { async, ComponentFixture, TestBed, getTestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { GraphComponent } from './graph.component'; import { PortComponent } from '../port/port.component'; import { ConnectionComponent } from '../connection/connection.component'; @Component({ selector: 'test', template: ` <ngcs-graph> <ngcs-port id="s"></ngcs-port> <ngcs-port id="t"></ngcs-port> <ngcs-connection from="s" to="t"></ngcs-connection> </ngcs-graph> `}) export class TestComponent {} describe('GraphComponent', () => { let component: TestComponent; let fixture: ComponentFixture<TestComponent>; beforeEach( async(() => { TestBed.configureTestingModule({ declarations: [TestComponent, GraphComponent, PortComponent, ConnectionComponent] }).compileComponents(); }) ); beforeEach(() => { fixture = TestBed.createComponent(TestComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should draw a line when adding a connection', () => { let pathElement = fixture.debugElement.query(By.css('path')); expect(pathElement).toBeDefined(); expect(pathElement.nativeElement.attributes.d.value).toBe("M0,0 C0,0 0,0 0,0"); }) });
Make a test of the graph
Make a test of the graph
TypeScript
mpl-2.0
gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph,gabyx/ExecutionGraph
--- +++ @@ -1,30 +1,45 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed, getTestBed } from '@angular/core/testing'; +import { Component } from '@angular/core'; +import { By } from '@angular/platform-browser'; import { GraphComponent } from './graph.component'; +import { PortComponent } from '../port/port.component'; +import { ConnectionComponent } from '../connection/connection.component'; + +@Component({ + selector: 'test', + template: ` +<ngcs-graph> + <ngcs-port id="s"></ngcs-port> + <ngcs-port id="t"></ngcs-port> + <ngcs-connection from="s" to="t"></ngcs-connection> +</ngcs-graph> +`}) +export class TestComponent {} + describe('GraphComponent', () => { - let component: GraphComponent; - let fixture: ComponentFixture<GraphComponent>; - + let component: TestComponent; + let fixture: ComponentFixture<TestComponent>; beforeEach( async(() => { TestBed.configureTestingModule({ - declarations: [GraphComponent] + declarations: [TestComponent, GraphComponent, PortComponent, ConnectionComponent] }).compileComponents(); }) ); beforeEach(() => { - fixture = TestBed.createComponent(GraphComponent); + fixture = TestBed.createComponent(TestComponent); component = fixture.componentInstance; + fixture.detectChanges(); }); - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should throw when adding a connection to an inexistant port', () => { - expect(() => component.registerConnection('foo', 'bar')).toThrow(); + it('should draw a line when adding a connection', () => { + + let pathElement = fixture.debugElement.query(By.css('path')); + expect(pathElement).toBeDefined(); + expect(pathElement.nativeElement.attributes.d.value).toBe("M0,0 C0,0 0,0 0,0"); }) });
b2616d49ac7ff2f627190cc1a3f7f868e8705ae0
tests/src/debugger.spec.ts
tests/src/debugger.spec.ts
import { expect } from "chai"; describe("Debugger", () => { describe("#constructor()", () => { it("should create a new debugger panel", () => { expect(true).to.be.true; }); }); });
import { expect } from 'chai'; import { Debugger } from '../../lib/debugger'; class TestPanel extends Debugger {} describe('Debugger', () => { let panel: TestPanel; beforeEach(() => { panel = new TestPanel({}); }); afterEach(() => { panel.dispose(); }); describe('#constructor()', () => { it('should create a new debugger panel', () => { expect(panel).to.be.an.instanceOf(Debugger); }); }); });
Add simple test for Debugger
Add simple test for Debugger
TypeScript
bsd-3-clause
jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab
--- +++ @@ -1,9 +1,23 @@ -import { expect } from "chai"; +import { expect } from 'chai'; -describe("Debugger", () => { - describe("#constructor()", () => { - it("should create a new debugger panel", () => { - expect(true).to.be.true; +import { Debugger } from '../../lib/debugger'; + +class TestPanel extends Debugger {} + +describe('Debugger', () => { + let panel: TestPanel; + + beforeEach(() => { + panel = new TestPanel({}); + }); + + afterEach(() => { + panel.dispose(); + }); + + describe('#constructor()', () => { + it('should create a new debugger panel', () => { + expect(panel).to.be.an.instanceOf(Debugger); }); }); });
74533a5fb25b8ffb98f49f00d6b8bf76e938b06d
src/main/stores/ContextMenuStore.ts
src/main/stores/ContextMenuStore.ts
import { observable, action } from 'mobx' import { MenuItem } from '../lib/contextMenu/interfaces' import { menuHeight, menuMargin, menuVerticalPadding } from '../lib/contextMenu/consts' export default class ContextMenuStore { @observable isOpen: boolean = false @observable xPosition: number = 0 @observable yPosition: number = 0 @observable menuItems: MenuItem[] = [] @observable id: number = 0 @action open(event: React.MouseEvent<unknown>, menuItems: MenuItem[]) { this.isOpen = true this.id++ this.menuItems = menuItems // TODO: Limit xPosition this.xPosition = event.clientX const yPositionLimit = window.innerHeight - menuHeight - menuMargin - menuVerticalPadding * 2 const clientYIsLowerThanYPositionLimit = event.clientY > yPositionLimit this.yPosition = clientYIsLowerThanYPositionLimit ? yPositionLimit : event.clientY } @action close() { this.isOpen = false } }
import { observable, action } from 'mobx' import { MenuItem } from '../lib/contextMenu/interfaces' import { menuHeight, menuMargin, menuVerticalPadding } from '../lib/contextMenu/consts' export default class ContextMenuStore { @observable isOpen: boolean = false @observable xPosition: number = 0 @observable yPosition: number = 0 @observable menuItems: MenuItem[] = [] @observable id: number = 0 @action open(event: React.MouseEvent<unknown>, menuItems: MenuItem[]) { this.isOpen = true this.id++ this.menuItems = menuItems // TODO: Limit xPosition this.xPosition = event.clientX const yPositionLimit = window.innerHeight - menuHeight * menuItems.length - menuMargin - menuVerticalPadding * 2 const clientYIsLowerThanYPositionLimit = event.clientY > yPositionLimit this.yPosition = clientYIsLowerThanYPositionLimit ? yPositionLimit : event.clientY } @action close() { this.isOpen = false } }
Include number of menu items in calculating position of context menu
Include number of menu items in calculating position of context menu
TypeScript
mit
Sarah-Seo/Inpad,Sarah-Seo/Inpad
--- +++ @@ -23,7 +23,10 @@ this.xPosition = event.clientX const yPositionLimit = - window.innerHeight - menuHeight - menuMargin - menuVerticalPadding * 2 + window.innerHeight - + menuHeight * menuItems.length - + menuMargin - + menuVerticalPadding * 2 const clientYIsLowerThanYPositionLimit = event.clientY > yPositionLimit this.yPosition = clientYIsLowerThanYPositionLimit ? yPositionLimit
b293d9178971f0f72796e5ec4246033631ae98e6
src/CK.Glouton.Web/app/src/app/modules/lucene/components/applicationNameSelector.component.ts
src/CK.Glouton.Web/app/src/app/modules/lucene/components/applicationNameSelector.component.ts
import { Component, OnInit } from '@angular/core'; import { LogService } from 'app/_services'; import { ILogView } from 'app/common/logs/models'; @Component({ selector: 'applicationNameSelector', templateUrl: 'applicationNameSelector.component.html' }) export class ApplicationNameSelectorComponent implements OnInit { private _applicationNames: string[]; private _selected: string[]; constructor( private logService: LogService ) { } onChange(_: boolean): void { console.log(this._selected); } ngOnInit(): void { this.logService.getAllApplicationName() .subscribe(n => this._applicationNames = n); } }
import { Component, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; import { EffectDispatcher } from '@ck/rx'; import { IAppState } from 'app/app.state'; import { LogService } from 'app/_services'; import { ILogView } from 'app/common/logs/models'; import { SubmitAppNamesEffect } from '../actions'; @Component({ selector: 'applicationNameSelector', templateUrl: 'applicationNameSelector.component.html' }) export class ApplicationNameSelectorComponent implements OnInit { private _applicationNames$: Observable<string[]>; private _applicationNames: string[]; private _selected: string[]; private _subscription: Subscription; constructor( private logService: LogService, private effectDispatcher: EffectDispatcher, private store: Store<IAppState> ) { this._applicationNames$ = this.store.select(s => s.luceneParameters.appNames); this._subscription = this._applicationNames$.subscribe(a => this._selected = a); } onChange(_: boolean): void { this.effectDispatcher.dispatch(new SubmitAppNamesEffect(this._selected)); } ngOnInit(): void { this.logService.getAllApplicationName() .subscribe(n => this._applicationNames = n); } }
Add actions behavior for applicationNameSelector.
Add actions behavior for applicationNameSelector.
TypeScript
mit
ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton
--- +++ @@ -1,6 +1,12 @@ import { Component, OnInit } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { Observable } from 'rxjs/Observable'; +import { Subscription } from 'rxjs/Subscription'; +import { EffectDispatcher } from '@ck/rx'; +import { IAppState } from 'app/app.state'; import { LogService } from 'app/_services'; import { ILogView } from 'app/common/logs/models'; +import { SubmitAppNamesEffect } from '../actions'; @Component({ selector: 'applicationNameSelector', @@ -9,16 +15,23 @@ export class ApplicationNameSelectorComponent implements OnInit { + private _applicationNames$: Observable<string[]>; private _applicationNames: string[]; + private _selected: string[]; + private _subscription: Subscription; constructor( - private logService: LogService + private logService: LogService, + private effectDispatcher: EffectDispatcher, + private store: Store<IAppState> ) { + this._applicationNames$ = this.store.select(s => s.luceneParameters.appNames); + this._subscription = this._applicationNames$.subscribe(a => this._selected = a); } onChange(_: boolean): void { - console.log(this._selected); + this.effectDispatcher.dispatch(new SubmitAppNamesEffect(this._selected)); } ngOnInit(): void {
29383de7ca8693c91c7255fc98c38a7f9b008d4c
src/app/journal/post-data.ts
src/app/journal/post-data.ts
export interface PostData { postId: number; date: number; title: string; content: string; tags: string[]; } export interface PostDataWrapper { posts: PostData[]; totalPages: number; }
/** * An interface which can be used by a class to encapsulate a journal post. */ export interface PostData { /** * The post's unique identifier. */ postId: number; /** * The post's date, represented as a timestamp. */ date: number; /** * The post title */ title: string; /** * The post's content */ content: string; /** * Tags associated with the post */ tags: string[]; } /** * An interface which can be used by a class to encapsulate a collection of * journal posts, and the pagination details. */ export interface PostDataWrapper { /** * The collection of posts */ posts: PostData[]; /** * The total number of pages with the settings defined in the API request */ totalPages: number; }
Add documentation to journal module interfaces
Add documentation to journal module interfaces
TypeScript
apache-2.0
jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog
--- +++ @@ -1,12 +1,45 @@ +/** + * An interface which can be used by a class to encapsulate a journal post. + */ export interface PostData { + /** + * The post's unique identifier. + */ postId: number; + + /** + * The post's date, represented as a timestamp. + */ date: number; + + /** + * The post title + */ title: string; + + /** + * The post's content + */ content: string; + + /** + * Tags associated with the post + */ tags: string[]; } +/** + * An interface which can be used by a class to encapsulate a collection of + * journal posts, and the pagination details. + */ export interface PostDataWrapper { + /** + * The collection of posts + */ posts: PostData[]; + + /** + * The total number of pages with the settings defined in the API request + */ totalPages: number; }
3c1e561335c8b6f85cb202a9e80a948a0eb03cc6
app/src/ui/lib/emoji-text.tsx
app/src/ui/lib/emoji-text.tsx
import * as React from 'react' interface IEmojiTextProps { readonly className?: string readonly emoji: Map<string, string> readonly children?: string } /** * A component which replaces any emoji shortcuts (e.g., :+1:) in its child text * with the appropriate image tag. */ export default class EmojiText extends React.Component<IEmojiTextProps, void> { public render() { const children = this.props.children as string || '' return ( <div className={this.props.className}> {emojificationNexus(children, this.props.emoji)} </div> ) } } /** Shoutout to @robrix's naming expertise. */ function emojificationNexus(str: string, emoji: Map<string, string>): JSX.Element | null { // If we've been given an empty string then return null so that we don't end // up introducing an extra empty <span>. if (!str.length) { return null } const pieces = str.split(/(:.*?:)/g) const elements = pieces.map(fragment => { const path = emoji.get(fragment) if (path) { return <img className='emoji' src={path}/> } else { return fragment } }) return <span>{elements}</span> }
import * as React from 'react' interface IEmojiTextProps { readonly className?: string readonly emoji: Map<string, string> readonly children?: string } /** * A component which replaces any emoji shortcuts (e.g., :+1:) in its child text * with the appropriate image tag. */ export default class EmojiText extends React.Component<IEmojiTextProps, void> { public render() { const children = this.props.children as string || '' return ( <div className={this.props.className}> {emojificationNexus(children, this.props.emoji)} </div> ) } } /** Shoutout to @robrix's naming expertise. */ function emojificationNexus(str: string, emoji: Map<string, string>): JSX.Element | null { // If we've been given an empty string then return null so that we don't end // up introducing an extra empty <span>. if (!str.length) { return null } const pieces = str.split(/(:.*?:)/g) const elements = pieces.map((fragment, i) => { const path = emoji.get(fragment) if (path) { return <img key={i} alt={fragment} title={fragment} className='emoji' src={path}/> } else { return fragment } }) return <span>{elements}</span> }
Add key, alt, and title to the emoji image
Add key, alt, and title to the emoji image
TypeScript
mit
kactus-io/kactus,j-f1/forked-desktop,j-f1/forked-desktop,artivilla/desktop,shiftkey/desktop,hjobrien/desktop,artivilla/desktop,j-f1/forked-desktop,gengjiawen/desktop,BugTesterTest/desktops,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop,BugTesterTest/desktops,desktop/desktop,desktop/desktop,gengjiawen/desktop,say25/desktop,hjobrien/desktop,say25/desktop,desktop/desktop,kactus-io/kactus,shiftkey/desktop,gengjiawen/desktop,hjobrien/desktop,kactus-io/kactus,say25/desktop,BugTesterTest/desktops,BugTesterTest/desktops,say25/desktop,hjobrien/desktop,shiftkey/desktop,artivilla/desktop,gengjiawen/desktop,desktop/desktop,kactus-io/kactus
--- +++ @@ -28,10 +28,10 @@ if (!str.length) { return null } const pieces = str.split(/(:.*?:)/g) - const elements = pieces.map(fragment => { + const elements = pieces.map((fragment, i) => { const path = emoji.get(fragment) if (path) { - return <img className='emoji' src={path}/> + return <img key={i} alt={fragment} title={fragment} className='emoji' src={path}/> } else { return fragment }
29e7fbbcaea54ebdd62691e71bcd262f079c8e96
src/component/feedback/FeedbackCES/sendFeedbackInput.ts
src/component/feedback/FeedbackCES/sendFeedbackInput.ts
import { IFeedbackCESForm } from 'component/feedback/FeedbackCES/FeedbackCESForm'; interface IFeedbackEndpointRequestBody { source: 'app' | 'app:segments'; data: { score: number; comment?: string; customerType?: 'open source' | 'paying'; openedManually?: boolean; currentPage?: string; }; } export const sendFeedbackInput = async ( form: Partial<IFeedbackCESForm> ): Promise<void> => { if (!form.score) { return; } const body: IFeedbackEndpointRequestBody = { source: 'app:segments', data: { score: form.score, comment: form.comment, currentPage: form.path, openedManually: false, customerType: 'paying', }, }; await fetch( 'https://europe-west3-docs-feedback-v1.cloudfunctions.net/function-1', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), } ); };
import { IFeedbackCESForm } from 'component/feedback/FeedbackCES/FeedbackCESForm'; interface IFeedbackEndpointRequestBody { source: 'app' | 'app:segments'; data: { score: number; comment?: string; customerType?: 'open source' | 'paying'; openedManually?: boolean; currentPage?: string; }; } export const sendFeedbackInput = async ( form: Partial<IFeedbackCESForm> ): Promise<void> => { if (!form.score) { return; } const body: IFeedbackEndpointRequestBody = { source: 'app:segments', data: { score: form.score, comment: form.comment, currentPage: form.path, openedManually: false, customerType: 'paying', }, }; await fetch( 'https://europe-west3-metrics-304612.cloudfunctions.net/docs-app-feedback', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), } ); };
Update target URL for sending feedback input
chore: Update target URL for sending feedback input
TypeScript
apache-2.0
Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend
--- +++ @@ -30,7 +30,7 @@ }; await fetch( - 'https://europe-west3-docs-feedback-v1.cloudfunctions.net/function-1', + 'https://europe-west3-metrics-304612.cloudfunctions.net/docs-app-feedback', { method: 'POST', headers: { 'Content-Type': 'application/json' },
c26d22751e29b99dc308c4ce6870591153f5a5bc
server/imports/publications/stores.ts
server/imports/publications/stores.ts
import { Meteor } from 'meteor/meteor'; import { Counts } from 'meteor/tmeasday:publish-counts'; import { Stores } from '../../../both/collections/stores.collection'; interface Options { [key: string]: any; } Meteor.publish('stores', function(options: Options, location?: string) { const selector = buildQuery.call(this, null, location); Counts.publish(this, 'numberOfStores', Stores.collection.find(selector), { noReady: true }); return Stores.find(selector, options); }); Meteor.publish('store', function(storeId: string) { return Stores.find(buildQuery.call(this, storeId)); }); function buildQuery(storeId?: string, location?: string): Object { const isAvailable = { }; if (storeId) { return { $and: [{ _id: storeId }, isAvailable ] }; } const searchRegEx = { '$regex': '.*' + (location || '') + '.*', '$options': 'i' }; return { $and: [ { $or : [ { 'name' :searchRegEx }, { 'description' : searchRegEx } , {'location.name': searchRegEx}] }, isAvailable ] }; }
import { Meteor } from 'meteor/meteor'; import { Counts } from 'meteor/tmeasday:publish-counts'; import { Stores } from '../../../both/collections/stores.collection'; interface Options { [key: string]: any; } Meteor.publish('stores', function(options: Options, searchValue?: string) { const selector = buildQuery.call(this, null, searchValue); Counts.publish(this, 'numberOfStores', Stores.collection.find(selector), { noReady: true }); return Stores.find(selector, options); }); Meteor.publish('store', function(storeId: string) { return Stores.find(buildQuery.call(this, storeId)); }); function buildQuery(storeId?: string, searchValue?: string): Object { const isAvailable = { }; if (storeId) { return { $and: [{ _id: storeId }, isAvailable ] }; } const searchRegEx = { '$regex': '.*' + (searchValue || '') + '.*', '$options': 'i' }; return { $and: [ { $or : [ { 'name' :searchRegEx }, { 'activities' : searchRegEx } , {'location.name': searchRegEx}] }, isAvailable ] }; }
Refactor server search Value for adding activities
Refactor server search Value for adding activities
TypeScript
mit
DarkChopper/yssi,DarkChopper/yssi,DarkChopper/yssi
--- +++ @@ -8,9 +8,9 @@ [key: string]: any; } -Meteor.publish('stores', function(options: Options, location?: string) { +Meteor.publish('stores', function(options: Options, searchValue?: string) { - const selector = buildQuery.call(this, null, location); + const selector = buildQuery.call(this, null, searchValue); Counts.publish(this, 'numberOfStores', Stores.collection.find(selector), { noReady: true }); @@ -21,7 +21,7 @@ return Stores.find(buildQuery.call(this, storeId)); }); -function buildQuery(storeId?: string, location?: string): Object { +function buildQuery(storeId?: string, searchValue?: string): Object { const isAvailable = { }; @@ -35,11 +35,11 @@ }; } - const searchRegEx = { '$regex': '.*' + (location || '') + '.*', '$options': 'i' }; + const searchRegEx = { '$regex': '.*' + (searchValue || '') + '.*', '$options': 'i' }; return { $and: [ - { $or : [ { 'name' :searchRegEx }, { 'description' : searchRegEx } , {'location.name': searchRegEx}] }, + { $or : [ { 'name' :searchRegEx }, { 'activities' : searchRegEx } , {'location.name': searchRegEx}] }, isAvailable ] };
a7a59abf65d4baf62f316ad73af6be6c3e247f17
src/client/index.ts
src/client/index.ts
/*#######. ########",#: #########',##". ##'##'## .##',##. ## ## ## # ##",#. ## ## ## ## ##' ## ## ## :## ## ## ##*/ import { workspace, ExtensionContext } from 'vscode' import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient' export function activate(context: ExtensionContext) { const serverModule = context.asAbsolutePath('build/server.js') const debugOptions = { execArgv: ['--nolazy', '--debug=6004'] } const serverOptions: ServerOptions = { run: { module: serverModule, transport: TransportKind.ipc }, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions } } const clientOptions: LanguageClientOptions = { // Register server for C and C++ files documentSelector: [ { scheme: 'file', language: 'c' }, { scheme: 'file', language: 'cpp' } ], synchronize: { configurationSection: 'clangComplete', fileEvents: workspace.createFileSystemWatcher('**/.clang_complete') } } const languageClient = new LanguageClient( 'ClangComplete', serverOptions, clientOptions ) context.subscriptions.push(languageClient.start()) }
/*#######. ########",#: #########',##". ##'##'## .##',##. ## ## ## # ##",#. ## ## ## ## ##' ## ## ## :## ## ## ##*/ import { workspace, ExtensionContext } from 'vscode' import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient' export function activate(context: ExtensionContext) { const serverModule = context.asAbsolutePath('build/server.js') const debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] } const serverOptions: ServerOptions = { run: { module: serverModule, transport: TransportKind.ipc }, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions } } const clientOptions: LanguageClientOptions = { // Register server for C and C++ files documentSelector: [ { scheme: 'file', language: 'c' }, { scheme: 'file', language: 'cpp' } ], synchronize: { configurationSection: 'clangComplete', fileEvents: workspace.createFileSystemWatcher('**/.clang_complete') } } const languageClient = new LanguageClient( 'ClangComplete', serverOptions, clientOptions ) context.subscriptions.push(languageClient.start()) }
Update debug port flag from `--debug` to `--inspect`
Update debug port flag from `--debug` to `--inspect`
TypeScript
mit
kube/vscode-clang-complete,kube/vscode-clang-complete
--- +++ @@ -18,7 +18,7 @@ export function activate(context: ExtensionContext) { const serverModule = context.asAbsolutePath('build/server.js') - const debugOptions = { execArgv: ['--nolazy', '--debug=6004'] } + const debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] } const serverOptions: ServerOptions = { run: {
6a410add9da01ba415751a0d4f11e10855b854c6
src/mavensmate/mavensMateAppConfig.ts
src/mavensmate/mavensMateAppConfig.ts
'use strict'; import path = require('path'); import * as operatingSystem from '../../src/workspace/operatingSystem'; import * as jsonFile from '../../src/workspace/jsonFile'; export function getConfig(){ let configFileDirectory = getUserHomeDirectory(); let configFileName = '.mavensmate-config.json'; let appConfigFilePath = path.join(configFileDirectory, configFileName); return jsonFile.open(appConfigFilePath); } function getUserHomeDirectory() { if(operatingSystem.isWindows()){ return process.env.USERPROFILE; } else if(operatingSystem.isMac() || operatingSystem.isLinux()){ return process.env.HOME; } else { throw new operatingSystem.UnexpectedPlatformError('Was not windows, mac, or linux'); } }
import path = require('path'); import * as operatingSystem from '../../src/workspace/operatingSystem'; import * as jsonFile from '../../src/workspace/jsonFile'; export function getConfig(){ let configFileDirectory = getUserHomeDirectory(); let configFileName = '.mavensmate-config.json'; let appConfigFilePath = path.join(configFileDirectory, configFileName); return jsonFile.open(appConfigFilePath); } function getUserHomeDirectory() { if(operatingSystem.isWindows()){ return process.env.USERPROFILE; } else if(operatingSystem.isMac() || operatingSystem.isLinux()){ return process.env.HOME; } else { throw new operatingSystem.UnexpectedPlatformError('Was not windows, mac, or linux'); } }
Remove 'use strict' because using eslint
Remove 'use strict' because using eslint
TypeScript
mit
joeferraro/MavensMate-VisualStudioCode
--- +++ @@ -1,5 +1,3 @@ -'use strict'; - import path = require('path'); import * as operatingSystem from '../../src/workspace/operatingSystem'; import * as jsonFile from '../../src/workspace/jsonFile';
752d8394993880d1e09ef0c3e379a1874ba6f588
src/lib/md5.ts
src/lib/md5.ts
import * as crypto from 'crypto'; import * as core from './core'; abstract class StringToMD5Transformer implements core.Transformer { protected abstract get digestMethodDescription(): string protected abstract get digestMethod(): crypto.HexBase64Latin1Encoding public get label(): string { return `String to MD5 Hash (${this.digestMethodDescription})`; } public get description(): string { return this.label; } public check(input: string): boolean { return true; } public transform(input: string): string { let hash = crypto.createHash('md5'); hash.update(input, 'utf8'); let output = hash.digest(this.digestMethod); return output; } } export class StringToMD5Base64Transformer extends StringToMD5Transformer{ protected get digestMethodDescription(): string { return "Base64 Encoded" } protected get digestMethod(): crypto.HexBase64Latin1Encoding { return "base64" } } export class StringToMD5HexTransformer extends StringToMD5Transformer { protected get digestMethodDescription(): string { return "Hex" } protected get digestMethod(): crypto.HexBase64Latin1Encoding { return "hex" } }
import * as crypto from 'crypto'; import * as core from './core'; abstract class StringToMD5Transformer implements core.Transformer { protected abstract get digestMethodDescription(): string protected abstract get digestMethod(): crypto.HexBase64Latin1Encoding public get label(): string { return `String to MD5 Hash (${this.digestMethodDescription})`; } public get description(): string { return this.label; } public check(input: string): boolean { return true; } public transform(input: string): string { let hash = crypto.createHash('md5'); hash.update(input, 'utf8'); let output = hash.digest(this.digestMethod); return output; } } export class StringToMD5Base64Transformer extends StringToMD5Transformer{ protected get digestMethodDescription(): string { return "as Base64" } protected get digestMethod(): crypto.HexBase64Latin1Encoding { return "base64" } } export class StringToMD5HexTransformer extends StringToMD5Transformer { protected get digestMethodDescription(): string { return "as Hex" } protected get digestMethod(): crypto.HexBase64Latin1Encoding { return "hex" } }
Tweak the descriptions for MD5.
Tweak the descriptions for MD5.
TypeScript
mit
mitchdenny/ecdc
--- +++ @@ -28,7 +28,7 @@ export class StringToMD5Base64Transformer extends StringToMD5Transformer{ protected get digestMethodDescription(): string { - return "Base64 Encoded" + return "as Base64" } protected get digestMethod(): crypto.HexBase64Latin1Encoding { @@ -38,7 +38,7 @@ export class StringToMD5HexTransformer extends StringToMD5Transformer { protected get digestMethodDescription(): string { - return "Hex" + return "as Hex" } protected get digestMethod(): crypto.HexBase64Latin1Encoding {
76f42150cb0cb0b150756f4ed82b4fc4254178c0
examples/official-storybook/stories/demo/setup.stories.tsx
examples/official-storybook/stories/demo/setup.stories.tsx
import React from 'react'; import { screen } from '@testing-library/dom'; import userEvent from '@testing-library/user-event'; const Input = () => <input />; export default { title: 'Other/Demo/Setup', component: Input, }; export const WithSetup = { setup: () => userEvent.type(screen.getByRole('textbox'), 'asdfasdf', { delay: 20 }), };
import React from 'react'; import { screen } from '@testing-library/dom'; import userEvent from '@testing-library/user-event'; const Input = () => <input data-testid="test-input" />; export default { title: 'Other/Demo/Setup', component: Input, }; export const WithSetup = { setup: () => userEvent.type(screen.getByTestId('test-input'), 'asdfasdf', { delay: 20 }), };
Use testId instead of role
Use testId instead of role
TypeScript
mit
storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -2,7 +2,7 @@ import { screen } from '@testing-library/dom'; import userEvent from '@testing-library/user-event'; -const Input = () => <input />; +const Input = () => <input data-testid="test-input" />; export default { title: 'Other/Demo/Setup', @@ -10,5 +10,5 @@ }; export const WithSetup = { - setup: () => userEvent.type(screen.getByRole('textbox'), 'asdfasdf', { delay: 20 }), + setup: () => userEvent.type(screen.getByTestId('test-input'), 'asdfasdf', { delay: 20 }), };
44103c2efe5e024389c26ccff598b2103ad4df4d
src/app/material-counts/MaterialCountsWrappers.tsx
src/app/material-counts/MaterialCountsWrappers.tsx
import { t } from 'app/i18next-t'; import { Observable } from 'app/utils/observable'; import { useSubscription } from 'use-subscription'; import Sheet from '../dim-ui/Sheet'; import { MaterialCounts } from './MaterialCounts'; import styles from './MaterialCountsWrappers.m.scss'; /** * The currently selected store for showing gear power. */ const doShowMaterialCounts$ = new Observable<boolean>(false); /** * Show the gear power sheet */ export function showMaterialCount() { doShowMaterialCounts$.next(true); } export function MaterialCountsSheet() { const isShown = useSubscription(doShowMaterialCounts$); if (!isShown) { return null; } const close = () => { doShowMaterialCounts$.next(false); }; return ( <Sheet onClose={close} header={<h1>{t('Header.MaterialCounts')}</h1>}> <div className={styles.container}> <MaterialCounts includeCurrencies /> </div> </Sheet> ); } export function MaterialCountsTooltip() { return ( <> {t('Header.MaterialCounts')} <hr /> <MaterialCounts wide /> </> ); }
import { PressTipHeader } from 'app/dim-ui/PressTip'; import { t } from 'app/i18next-t'; import { Observable } from 'app/utils/observable'; import { useSubscription } from 'use-subscription'; import Sheet from '../dim-ui/Sheet'; import { MaterialCounts } from './MaterialCounts'; import styles from './MaterialCountsWrappers.m.scss'; /** * The currently selected store for showing gear power. */ const doShowMaterialCounts$ = new Observable<boolean>(false); /** * Show the gear power sheet */ export function showMaterialCount() { doShowMaterialCounts$.next(true); } export function MaterialCountsSheet() { const isShown = useSubscription(doShowMaterialCounts$); if (!isShown) { return null; } const close = () => { doShowMaterialCounts$.next(false); }; return ( <Sheet onClose={close} header={<h1>{t('Header.MaterialCounts')}</h1>}> <div className={styles.container}> <MaterialCounts includeCurrencies /> </div> </Sheet> ); } export function MaterialCountsTooltip() { return ( <> <PressTipHeader header={t('Header.MaterialCounts')} /> <MaterialCounts wide /> </> ); }
Add PressTipHeader to material counts tooltip.
Add PressTipHeader to material counts tooltip.
TypeScript
mit
DestinyItemManager/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM
--- +++ @@ -1,3 +1,4 @@ +import { PressTipHeader } from 'app/dim-ui/PressTip'; import { t } from 'app/i18next-t'; import { Observable } from 'app/utils/observable'; import { useSubscription } from 'use-subscription'; @@ -39,8 +40,7 @@ export function MaterialCountsTooltip() { return ( <> - {t('Header.MaterialCounts')} - <hr /> + <PressTipHeader header={t('Header.MaterialCounts')} /> <MaterialCounts wide /> </> );
b26fad225ecd8e442f4476309f230d39891a8d97
src/ngx-auto-scroll.directive.ts
src/ngx-auto-scroll.directive.ts
import {AfterContentInit, Directive, ElementRef, HostListener, Input, OnDestroy} from "@angular/core"; @Directive({ selector: "[ngx-auto-scroll]", }) export class NgxAutoScroll implements AfterContentInit, OnDestroy { @Input("lock-y-offset") public lockYOffset: number = 10; @Input("observe-attributes") public observeAttributes: string = "false"; private nativeElement: HTMLElement; private isLocked: boolean = false; private mutationObserver: MutationObserver; constructor(element: ElementRef) { this.nativeElement = element.nativeElement; } public getObserveAttributes(): boolean { return this.observeAttributes !== "" && this.observeAttributes.toLowerCase() !== "false"; } public ngAfterContentInit(): void { this.mutationObserver = new MutationObserver(() => { if (!this.isLocked) { this.nativeElement.scrollTop = this.nativeElement.scrollHeight; } }); this.mutationObserver.observe(this.nativeElement, { childList: true, subtree: true, attributes: this.getObserveAttributes(), }); } public ngOnDestroy(): void { this.mutationObserver.disconnect(); } @HostListener("scroll") private scrollHandler(): void { const scrollFromBottom = this.nativeElement.scrollHeight - this.nativeElement.scrollTop - this.nativeElement.clientHeight; this.isLocked = scrollFromBottom > this.lockYOffset; } }
import {AfterContentInit, Directive, ElementRef, HostListener, Input, OnDestroy} from "@angular/core"; @Directive({ selector: "[ngx-auto-scroll]", }) export class NgxAutoScroll implements AfterContentInit, OnDestroy { @Input("lock-y-offset") public lockYOffset: number = 10; @Input("observe-attributes") public observeAttributes: string = "false"; private nativeElement: HTMLElement; private isLocked: boolean = false; private mutationObserver: MutationObserver; constructor(element: ElementRef) { this.nativeElement = element.nativeElement; } public getObserveAttributes(): boolean { return this.observeAttributes !== "" && this.observeAttributes.toLowerCase() !== "false"; } public ngAfterContentInit(): void { this.mutationObserver = new MutationObserver(() => { if (!this.isLocked) { this.scrollDown(); } }); this.mutationObserver.observe(this.nativeElement, { childList: true, subtree: true, attributes: this.getObserveAttributes(), }); } public ngOnDestroy(): void { this.mutationObserver.disconnect(); } public forceScrollDown(): void { this.scrollDown(); } private scrollDown(): void { this.nativeElement.scrollTop = this.nativeElement.scrollHeight; } @HostListener("scroll") private scrollHandler(): void { const scrollFromBottom = this.nativeElement.scrollHeight - this.nativeElement.scrollTop - this.nativeElement.clientHeight; this.isLocked = scrollFromBottom > this.lockYOffset; } }
Add method to force scroll down
Add method to force scroll down
TypeScript
mit
NagRock/angular2-auto-scroll
--- +++ @@ -22,7 +22,7 @@ public ngAfterContentInit(): void { this.mutationObserver = new MutationObserver(() => { if (!this.isLocked) { - this.nativeElement.scrollTop = this.nativeElement.scrollHeight; + this.scrollDown(); } }); this.mutationObserver.observe(this.nativeElement, { @@ -36,6 +36,14 @@ this.mutationObserver.disconnect(); } + public forceScrollDown(): void { + this.scrollDown(); + } + + private scrollDown(): void { + this.nativeElement.scrollTop = this.nativeElement.scrollHeight; + } + @HostListener("scroll") private scrollHandler(): void { const scrollFromBottom = this.nativeElement.scrollHeight - this.nativeElement.scrollTop - this.nativeElement.clientHeight;
f9b45b5c00cb39f567b42696c5f076eeb179afd9
test/integration/contentful-client.ts
test/integration/contentful-client.ts
import * as contentful from 'contentful-management' if (!process.env.CONTENTFUL_CMA_TOKEN) { require('dotenv').config() } export const client = contentful.createClient({ accessToken: process.env.CONTENTFUL_CMA_TOKEN }) export const getCurrentSpace = () => client.getSpace(process.env.CONTENTFUL_SPACE_ID)
import * as contentful from 'contentful-management' if (!process.env.CONTENTFUL_CMA_TOKEN) { require('dotenv').config() } export const client = contentful.createClient({ accessToken: process.env.CONTENTFUL_CMA_TOKEN as string }) export const getCurrentSpace = () => client.getSpace(process.env.CONTENTFUL_SPACE_ID as string)
Fix linting errors in integration tests
Fix linting errors in integration tests
TypeScript
mit
contentful/widget-sdk
--- +++ @@ -5,7 +5,7 @@ } export const client = contentful.createClient({ - accessToken: process.env.CONTENTFUL_CMA_TOKEN + accessToken: process.env.CONTENTFUL_CMA_TOKEN as string }) -export const getCurrentSpace = () => client.getSpace(process.env.CONTENTFUL_SPACE_ID) +export const getCurrentSpace = () => client.getSpace(process.env.CONTENTFUL_SPACE_ID as string)
1275a715434469aa871ed9e8e0830e95866db87f
templates/module/_name.module.ts
templates/module/_name.module.ts
import * as angular from "angular"; <% if (!moduleOnly) { %>import { <%= pName %>Config } from "./<%= hName %>.config"; import { <%= pName %>Controller } from "./<%= hName %>.controller"; <% } %>export const <%= name %> = angular .module("<%= appName %>.<%= name %>", ["ui.router"])<% if (!moduleOnly) { %> .controller("<%= pName %>", <%= pName %>Controller) .config(<%= pName %>Config)<% } %> .name;
import * as angular from "angular"; <% if (!moduleOnly) { %>import { <%= pName %>Config } from "./<%= hName %>.config"; import { <%= pName %>Controller } from "./<%= hName %>.controller"; <% } %>export const <%= name %> = angular .module("<%= appName %>.<%= name %>", ["ui.router"])<% if (!moduleOnly) { %> .controller("<%= pName %>Controller", <%= pName %>Controller) .config(<%= pName %>Config)<% } %> .name;
Fix an error with the used controller
Fix an error with the used controller
TypeScript
mit
Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli
--- +++ @@ -4,6 +4,6 @@ <% } %>export const <%= name %> = angular .module("<%= appName %>.<%= name %>", ["ui.router"])<% if (!moduleOnly) { %> - .controller("<%= pName %>", <%= pName %>Controller) + .controller("<%= pName %>Controller", <%= pName %>Controller) .config(<%= pName %>Config)<% } %> .name;