Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ember-cli-clipboard
Advanced tools
A simple ember wrapper around clipboard.js (no flash)
http://jkusa.github.io/ember-cli-clipboard
<!-- Set text directly -->
{{#copy-button
clipboardText='text to be copied'
success=(action 'success')
error=(action 'error')
}}
Click To Copy
{{/copy-button}}
<!-- Get text from target element -->
<input id="url" type="text" value="https://github.com/jkusa/ember-cli-clipboard">
{{#copy-button
clipboardTarget="#url"
success=(action 'success')
error=(action 'error')
}}
Click To Copy
{{/copy-button}}
clipboardText
- string value to be copiedclipboardTarget
- selector string of element from which to copy textclipboardAction
- string value of operation: copy
or cut
(default is copy)title
- string value of the button's title attributebuttonType
- string value of the button's type attributedisabled
- boolean value of the button's disabled attributearia-label
- string value of the button's aria-label attributeThe following clipboard.js custom events are sent as actions
success
sent on successful copyerror
sent on failed copyMore information about the clipboard.js events can be found here
The helper is-clipboard-supported
can be used to check if clipboard.js is supported or not.
{{#if (is-clipboard-supported)}}
{{#copy-button clipboardTarget="#url"}}
Click To Copy
{{/copy-button}}
{{/if}}
Some browsers do not allow simulated clicks to fire execCommand('copy')
. This makes testing difficult. To assist with integration testing, the following test helpers are available to test the wiring of the success
and error
action handlers.
triggerSuccess(context, selector='.copy-btn')
triggerError(context, selector='.copy-btn')
Example:
// tests/integration/components/my-test.js
...
import {
triggerError,
triggerSuccess
} from '../../helpers/ember-cli-clipboard';
...
test('copy-button integration', function(assert) {
assert.expect(2);
this.set('success', () => {
assert.ok(true, '`success` action handler correctly fired');
});
this.set('error', () => {
assert.ok(true, '`error` action handler correctly fired');
});
this.render(hbs`
{{#copy-button
classNames='my-copy-btn'
clipboardText='text to copy'
success=(action success)
error=(action error)
}}
Click To Copy
{{/copy-button}}
`);
triggerError(this, '.my-copy-btn');
triggerSuccess(this, '.my-copy-btn');
});
triggerCopySuccess(selector='.copy-btn')
triggerCopyError(selector='.copy-btn')
To use the helpers in acceptance tests you need to register them in the /tests/helpers/start-app.js
file.
// tests/helpers/start-app.js
...
import registerClipboardHelpers from '../helpers/ember-cli-clipboard';
registerClipboardHelpers();
export default function startApp(attrs) {
...
Example:
// tests/acceptance/my-test.js
...
test('copy button message', function(assert) {
assert.expect(3);
visit('/');
andThen(() => {
assert.notOk(!!find('.alert').length,
'no alert message is initially present');
});
triggerCopySuccess();
andThen(() => {
assert.ok(!!find('.alert.alert-success').length,
'a success message is displayed when a copy is successful');
});
triggerCopyError();
andThen(() => {
assert.ok(!!find('.alert.alert-info').length,
'an error message is displayed when a copy is unsuccessful');
});
});
For browser support information, checkout the clipboard.js documentation:
https://github.com/zenorocha/clipboard.js/#browser-support
git clone
this repositorynpm install
bower install
ember server
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
FAQs
Clipboard.js button component
The npm package ember-cli-clipboard receives a total of 17,765 weekly downloads. As such, ember-cli-clipboard popularity was classified as popular.
We found that ember-cli-clipboard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.