forked from aws/aws-toolkit-vscode
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a help button to the sam init wizard's runtime selection step (a…
- Loading branch information
1 parent
61d1102
commit 3477680
Showing
10 changed files
with
154 additions
and
33 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*! | ||
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
import * as path from 'path' | ||
import { ExtensionContext, QuickInputButton, Uri } from 'vscode' | ||
|
||
/** | ||
* Creates a QuickInputButton with a predefined help button (dark and light theme compatible) | ||
* Images are only loaded after extension.ts loads; this should happen on any user-facing extension usage. | ||
* button will exist regardless of image loading (UI tests will still see this) | ||
* @param tooltip Optional tooltip for button | ||
*/ | ||
export function createHelpButton( | ||
context: Pick<ExtensionContext, 'asAbsolutePath'>, | ||
tooltip?: string | ||
): QuickInputButton { | ||
const light = path.join(context.asAbsolutePath('resources'), 'light', 'help.svg') | ||
const dark = path.join(context.asAbsolutePath('resources'), 'dark', 'help.svg') | ||
|
||
return { | ||
iconPath: { | ||
light: Uri.file(light), | ||
dark: Uri.file(dark) | ||
}, | ||
tooltip | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*! | ||
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
import * as assert from 'assert' | ||
import * as vscode from 'vscode' | ||
import * as buttons from '../../../shared/ui/buttons' | ||
import { FakeExtensionContext } from '../../fakeExtensionContext' | ||
|
||
describe('UI buttons', () => { | ||
|
||
const extContext = new FakeExtensionContext() | ||
|
||
it('creates a help button without a tooltip or icons', () => { | ||
const help = buttons.createHelpButton(extContext) | ||
const paths = help.iconPath as {light: vscode.Uri, dark: vscode.Uri} | ||
|
||
assert.strictEqual(help.tooltip, undefined) | ||
assert.ok(paths.light) | ||
assert.ok(paths.dark) | ||
}) | ||
|
||
it('creates a help button with a tooltip', () => { | ||
const tooltip = 'you must be truly desperate to come to me for help' | ||
const help = buttons.createHelpButton(extContext, tooltip) | ||
|
||
assert.strictEqual(help.tooltip, tooltip) | ||
}) | ||
}) |