Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-mock

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-mock - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

96

lib/chrome/ContextMenus.js

@@ -0,6 +1,9 @@

var Event = require('../Event');
var sinon = require('sinon');
module.exports = ContextMenus;
/**
* Use the <code>chrome.contextMenus</code> API to add items to Google Chrome's context
* menu. You can choose what types of objects your context menu additions apply to,
* such as images, hyperlinks, and pages.
* @constructor

@@ -11,25 +14,76 @@ * @param {object} chrome

this.chrome = chrome;
this.menus = [];
this.create = sinon.spy(create.bind(this));
}
/**
* @property {array}
*/
ContextMenus.prototype.menus = null;
/**
* The maximum number of top level extension items that can be added to an extension
* action context menu. Any items beyond this limit will be ignored.
* @property {undefined}
*/
this.ACTION_MENU_TOP_LEVEL_LIMIT = null;
/**
* Creates a new context menu item. Note that if an error occurs during creation,
* you may not find out until the creation callback fires (the details will be in
* chrome.runtime.lastError).
* @param {object} createProperties
* @param {function} callback
*/
function create(createProperties, callback) {
this.menus.push(createProperties);
if (typeof callback === 'function') {
callback();
}
/**
* Creates a new context menu item. Note that if an error occurs during creation, you
* may not find out until the creation callback fires (the details will be in chro
* me.runtime.lastError).
*
* @param {object} createProperties
* @param {function} callback Called when the item has been created in the browser. If there were any probl...
* @returns {undefined} The ID of the newly created item.
*/
this.create = sinon.spy(function (createProperties, callback) {
if (typeof callback === 'function') {
callback();
}
});
/**
* Updates a previously created context menu item.
*
* @param {undefined} id The ID of the item to update.
* @param {object} updateProperties The properties to update. Accepts the same values as the create function.
* @param {function} callback Called when the context menu has been updated.
*/
this.update = sinon.spy(function (id, updateProperties, callback) {
if (typeof callback === 'function') {
callback();
}
});
/**
* Removes a context menu item.
*
* @param {undefined} menuItemId The ID of the context menu item to remove.
* @param {function} callback Called when the context menu has been removed.
*/
this.remove = sinon.spy(function (menuItemId, callback) {
if (typeof callback === 'function') {
callback();
}
});
/**
* Removes all context menu items added by this extension.
*
* @param {function} callback Called when removal is complete.
*/
this.removeAll = sinon.spy(function (callback) {
if (typeof callback === 'function') {
callback();
}
});
/**
* onClicked Event
*/
this.onClicked = new Event();
}
{
"name": "chrome-mock",
"version": "0.0.7",
"version": "0.0.8",
"author": "Steven Foote & Seth McLaughlin",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc