Best JavaScript code snippet using wpt
execution_summary.js
Source:execution_summary.js
1"use strict";2function showSection(/*HTMLElement*/icon) {3 let sectionId = $(icon.parentNode).attr('target');4 if (sectionId) { $('#' + sectionId).show(250); }5}6function hideSection(/*HTMLElement*/icon) {7 let sectionId = $(icon.parentNode).attr('target');8 if (sectionId) { $('#' + sectionId).hide(250); }9}10/**11 * off=true means currently not showing '...' only12 * @param target13 * @returns {boolean}14 */15function isCurrentlyOff(/*HTMLElement|String*/target) {16 let elem = (typeof target) === 'string' ? $('#' + target) : $(target);17 return elem && elem.attr('class') && elem.attr('class').indexOf('off') > -1;18}19function turnOn(/*HTMLElement*/icon, /*String?*/classes) {20 $(icon).attr('class', (classes || 'fas fa-toggle-on') + ' on');21 return $(icon);22}23function turnOff(/*HTMLElement*/icon, /*String?*/classes) {24 $(icon).attr('class', (classes || 'fas fa-toggle-off') + ' off');25 return $(icon);26}27let toggleOptions = {duration: 100, easing: 'linear'};28function toggleShowHide(icon, selectors) {29 if (!icon || !selectors) { return; }30 if (isCurrentlyOff(icon)) {31 $(selectors).show(toggleOptions);32 turnOn(icon);33 } else {34 $(selectors).hide(toggleOptions);35 turnOff(icon);36 }37}38function showStepDetailSections() {39 $('.iteration').show(toggleOptions);40 $('.exec-summary .showhide').show(toggleOptions);41}42function showHideStepDetailSection() {43 if (isCurrentlyOff('iteration-toggle') || isCurrentlyOff('scenario-toggle') || isCurrentlyOff('activity-toggle')) {44 turnOff($('#all-toggle')[0], 'fas fa-check-circle');45 }46 if (isCurrentlyOff('iteration-toggle') && isCurrentlyOff('scenario-toggle') && isCurrentlyOff('activity-toggle')) {47 $('.iteration').hide(toggleOptions);48 $('.exec-summary .showhide').hide(toggleOptions);49 }50 if (isCurrentlyOff('script-toggle')) { $('.exec-summary .showhide').hide(toggleOptions); }51}52function toggleScript(/*HTMLElement*/icon) {53 toggleShowHide(icon, '.plan-step-summary, .exec-summary .showhide');54 showHideStepDetailSection();55 if (isCurrentlyOff('script-toggle')) {56 $('.exec-summary-header').hide(toggleOptions);57 } else {58 $('.exec-summary-header').show(toggleOptions);59 }60}61function toggleIteration(/*HTMLElement*/icon) {62 showStepDetailSections();63 toggleShowHide(icon, '.iter');64 showHideStepDetailSection();65}66function toggleScenario(/*HTMLElement*/icon) {67 showStepDetailSections();68 toggleShowHide(icon, '.scenario');69 showHideStepDetailSection();70}71function toggleActivity(/*HTMLElement*/icon) {72 showStepDetailSections();73 toggleShowHide(icon, '.activity');74 showHideStepDetailSection();75}76function toggleRefs(/*HTMLElement*/icon) {77 toggleShowHide(icon, '.value-scriptRef, .value-scenarioRef');78}79function collapsePassRows(/*HTMLElement*/icon) {80 $('tr.noFailure').css('visibility', 'collapse');81 // hide the entirety of steps that pass 100%82 $('.planStep:has(.plan-step-summary tr.noFailure)').hide(toggleOptions);83 turnOn($('#failure-toggle')[0], 'fas fa-exclamation-circle');84 turnOff($('#all-toggle')[0], 'fas fa-check-circle');85}86function showPassRows(/*HTMLElement*/icon) {87 $('tr.noFailure').css('visibility', 'visible');88 // hide the entirety of steps that pass 100%89 $('.planStep:has(.plan-step-summary tr.noFailure)').show(toggleOptions);90 turnOff($('#script-toggle')[0]).trigger('click');91 turnOff($('#iteration-toggle')[0]).trigger('click');92 turnOff($('#scenario-toggle')[0]).trigger('click');93 turnOff($('#activity-toggle')[0]).trigger('click');94 turnOff($('#failure-toggle')[0], 'fas fa-exclamation-circle');95 turnOn($('#all-toggle')[0], 'fas fa-check-circle');96 turnOn($('#collapse-toggle'), 'fas fa-expand');97}98function toggleExpansion(/*HTMLElement*/icon) {99 if (isCurrentlyOff(icon)) {100 $('.showhide').each(function (index, elem) { $('#' + $(elem).attr('target')).show(toggleOptions); });101 showHideStepDetailSection();102 turnOn(icon, 'fas fa-expand');103 } else {104 $('.showhide').each(function (index, elem) { $('#' + $(elem).attr('target')).hide(toggleOptions); });105 turnOff(icon, 'fas fa-compress');106 }...
ToggleContainerMgr.js
Source:ToggleContainerMgr.js
1import { SessionMgr } from 'src/managers/SessionMgr'2const ToggleOptions = {3 SHOW_ALL: { label: 'Show All', value: 'all' }, 4 SHOW_AVAILABLE: { label: 'Available', value: 'available' },5 SORT_NAME: { label: 'Sort by Name', value: 'name' },6 SORT_DATE: { label: 'Date', value: 'date' },7 SORT_PRICE_HIGH: { label: 'Price (Highest)', value: "price" }, 8 SORT_PRICE_LOW: { label: 'Price (Lowest)', value: "low" },9 CARRIER_USPS: { label: 'USPS', value: 'usps' }, 10 CARRIER_FEDEX: { label: 'FedEx', value: 'fedex' }, 11 CARRIER_OTHER: { label: 'Other', value: 'other' }, 12}13export class ToggleContainerMgr {14 static getShowItemsContainer() {15 return createToggleContainer([ ToggleOptions.SHOW_ALL, ToggleOptions.SHOW_AVAILABLE ], "ShowItemsModel")16 }17 static getSortItemsContainer() {18 return createToggleContainer([ ToggleOptions.SORT_NAME, ToggleOptions.SORT_DATE ], "SortItemsModel")19 }20 static getSortItemsFullContainer() {21 return createToggleContainer(22 [ ToggleOptions.SORT_NAME, ToggleOptions.SORT_DATE, ToggleOptions.SORT_PRICE_HIGH, ToggleOptions.SORT_PRICE_LOW ],23 "SortItemsFullModel")24 }25 static getCarriersContainer() {26 return createToggleContainer(27 [ ToggleOptions.CARRIER_USPS, ToggleOptions.CARRIER_FEDEX, ToggleOptions.CARRIER_OTHER ], 28 "CarriersModel")29 }30 static isShowItemsAll(toggleContainer) { return isModel(toggleContainer, ToggleOptions.SHOW_ALL) }31 static isSortItemsByName(toggleContainer) { return isModel(toggleContainer, ToggleOptions.SORT_NAME) }32 static isSortItemsByDate(toggleContainer) { return isModel(toggleContainer, ToggleOptions.SORT_DATE) }33 static isSortItemsByPriceHighest(toggleContainer) { return isModel(toggleContainer, ToggleOptions.SORT_PRICE_HIGH) }34 static isSortItemsByPriceLowest(toggleContainer) { return isModel(toggleContainer, ToggleOptions.SORT_PRICE_LOW) }35 static isUSPS(toggleContainer) { return isModel(toggleContainer, ToggleOptions.CARRIER_USPS) }36 static isFedEx(toggleContainer) { return isModel(toggleContainer, ToggleOptions.CARRIER_FEDEX) }37}38function createToggleContainer(options, sessionKey) { 39 const toggleContainer = {40 model: options[0].value, 41 options: options,42 sessionKey: sessionKey,43 }44 const model = SessionMgr.get(toggleContainer.sessionKey)45 if (model != null) { toggleContainer.model = model }46 return toggleContainer47}...
options.js
Source:options.js
1import React, { Fragment } from 'react'2import DeleteConversation from './deleteCon'3import UnsendMessages from './unsendMssgs'4import ImageMessage from './imageMessage'5import StickerMessage from './stickerMessage'6import ConversationShowMore from './showMore'7import PropTypes from 'prop-types'8const ConversationOptions = ({ hideConversation, toggleOptions }) => {9 return (10 <Fragment>11 <ul>12 <DeleteConversation13 toggleOptions={toggleOptions}14 hideConversation={hideConversation}15 />16 <UnsendMessages toggleOptions={toggleOptions} />17 <ImageMessage toggleOptions={toggleOptions} />18 <StickerMessage toggleOptions={toggleOptions} />19 <ConversationShowMore toggleOptions={toggleOptions} />20 </ul>21 </Fragment>22 )23}24ConversationOptions.propTypes = {25 toggleOptions: PropTypes.func.isRequired,26 hideConversation: PropTypes.func.isRequired,27}...
Using AI Code Generation
1wptoolbar.toggleOptions();2wptoolbar.toggleOptions();3wptoolbar.toggleOptions();4wptoolbar.toggleOptions();5wptoolbar.toggleOptions();6wptoolbar.toggleOptions();7wptoolbar.toggleOptions();8wptoolbar.toggleOptions();9wptoolbar.toggleOptions();10wptoolbar.toggleOptions();11wptoolbar.toggleOptions();12wptoolbar.toggleOptions();13wptoolbar.toggleOptions();14wptoolbar.toggleOptions();15wptoolbar.toggleOptions();16wptoolbar.toggleOptions();17wptoolbar.toggleOptions();18wptoolbar.toggleOptions();19wptoolbar.toggleOptions();20wptoolbar.toggleOptions();21wptoolbar.toggleOptions();22wptoolbar.toggleOptions();23wptoolbar.toggleOptions();
Using AI Code Generation
1var wptoggle = require('wptoggle');2wptoggle.toggleOptions();3var wptoggle = require('wptoggle');4wptoggle.toggleOptions();5var wptoggle = require('wptoggle');6wptoggle.toggleOptions();7var wptoggle = require('wptoggle');8wptoggle.toggleOptions();9var wptoggle = require('wptoggle');10wptoggle.toggleOptions();11var wptoggle = require('wptoggle');12wptoggle.toggleOptions();13var wptoggle = require('wptoggle');14wptoggle.toggleOptions();15var wptoggle = require('wptoggle');16wptoggle.toggleOptions();17var wptoggle = require('wptoggle');18wptoggle.toggleOptions();19var wptoggle = require('wptoggle');20wptoggle.toggleOptions();21var wptoggle = require('wptoggle');22wptoggle.toggleOptions();23var wptoggle = require('wptoggle');24wptoggle.toggleOptions();25var wptoggle = require('wptoggle');26wptoggle.toggleOptions();
Using AI Code Generation
1var wptb = document.getElementById("wptoolbarbutton");2wptb.toggleOptions();3toggleOptions: function() {4 var wptb = document.getElementById("wptoolbarbutton");5 var wptbOptions = document.getElementById("wptoolbarbutton-options");6 if (wptbOptions.style.display == "none") {7 wptb.setAttribute("open", "true");8 wptbOptions.style.display = "block";9 wptbOptions.style.visibility = "visible";10 } else {11 wptb.setAttribute("open", "false");12 wptbOptions.style.display = "none";13 wptbOptions.style.visibility = "hidden";14 }15},16 <menuitem label="Test" oncommand="wptoolbarbutton.toggleOptions()"/>17 <menuitem label="Test2" oncommand="wptoolbarbutton.toggleOptions()"/>
Using AI Code Generation
1var wpt = new wptoggle();2wpt.toggleOptions('wptoggle_options');3}4add_action('admin_head', 'wptoggle_options_js');5function wptoggle_options_add_page() {6 add_options_page('WP Toggle Options', 'WP Toggle Options', 'manage_options', 'wptoggle_options', 'wptoggle_options_do_page');7}8add_action('admin_menu', 'wptoggle_options_add_page');9function wptoggle_options_do_page() {10 <?php settings_fields('wptoggle_options'); ?>11 <?php do_settings_sections('wptoggle_options'); ?>12 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />13}14function wptoggle_options_init() {15 register_setting('wptoggle_options', 'wptoggle_options', 'wptoggle_options_validate');16 add_settings_section('wptoggle_main', 'Main Settings', 'wptoggle_section_text', 'wptoggle_options');17 add_settings_field('wptoggle_text_string', 'Text String', 'wptoggle_setting_string', 'wptoggle_options', 'wptoggle_main');18 add_settings_field('wptoggle_css_id', 'CSS ID', 'wptoggle_setting_id', 'wptoggle_options', 'wptoggle_main');19 add_settings_field('wptoggle_css_class', 'CSS Class', 'wptoggle_setting_class', 'wptoggle_options', 'wptoggle_main');20}21add_action('admin_init', 'wptoggle_options_init');22function wptoggle_section_text() {23 echo '<p>Main description of this section here.</p>';24}25function wptoggle_setting_string() {26 $options = get_option('wptoggle_options');
Using AI Code Generation
1var wptoolbar = document.getElementById('wptoolbar');2wptoolbar.toggleOptions();3function toggleOptions() {4 if (options.style.display == "block") {5 options.style.display = "none";6 } else {7 options.style.display = "block";8 }9}10var wptoolbar = document.getElementById('wptoolbar');11wptoolbar.toggleOptions();12function toggleOptions() {13 if (options.style.display == "block") {14 options.style.display = "none";15 } else {16 options.style.display = "block";17 }18}19var wptoolbar = document.getElementById('wptoolbar');20wptoolbar.toggleOptions();21function toggleOptions() {22 if (options.style.display == "block") {23 options.style.display = "none";24 } else {25 options.style.display = "block";26 }27}28var wptoolbar = document.getElementById('wptoolbar');29wptoolbar.toggleOptions();30function toggleOptions() {31 if (options.style.display == "block") {32 options.style.display = "none";33 } else {34 options.style.display = "block";35 }36}
Using AI Code Generation
1var wpToolbar = require("wp-toolbar");2var toolbar = new wpToolbar();3toolbar.toggleOptions();4### toggleOptions()5### toggleHelp()6### toggleTools()7### toggleEditor()8### togglePreview()9### toggleSettings()10### toggleMore()11### toggleSite()12### toggleMenus()13### toggleWidgets()14### toggleCustomize()15### toggleComments()16### toggleUpdates()17### toggleNew()18### toggleDrafts()19### toggleTrash()20### toggleMedia()21### togglePages()22### togglePosts()23### toggleCategories()24### toggleTags()25### toggleAppearance()26### togglePlugins()27### toggleUsers()28### toggleTools()29### toggleSettings()30### toggleProfile()31### toggleMyAccount()32### toggleSiteName()33### toggleViewSite()34### toggleDashboard()35### toggleNewPost()36### toggleNewPage()
Using AI Code Generation
1wptoggle.toggleOptions( 'toggle-1', 'toggle-2' );2.wp-toggle-button {3 background-color: #f1f1f1;4 border: none;5 color: #666;6 padding: 10px 15px;7 text-align: center;8 text-decoration: none;9 display: inline-block;10 font-size: 16px;11 margin: 4px 2px;12 cursor: pointer;13 border-radius: 4px;14 transition: background-color 0.3s;15}16.wp-toggle-button:hover {17 background-color: #ddd;18}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!