How to use selector - 10 common examples

To help you get started, we’ve selected a few selector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dsheiko / puppetry / src / component / AppLayout / TestReport.jsx View on Github external
run = async () => {
    const { project, environment } = this.props,
          // options from Report modal like interactiveMode, updateSnapshot
          options = this.props.options || {};
    this.props.action.saveSuite();
    this.props.action.resetCommandFailures();
    try {
      // contains file:line:col from error report
      this.reportedFailures = [];
      this.runtimeTemp = getRuntimeTestPath();
      this.setState({ loading: true });
      const activeEnv = getActiveEnvironment( project.environments, environment ),
            specList = await exportProject(
              this.props.projectDirectory,
              this.runtimeTemp,
              this.props.checkedList,
              {
                headless: ( options.interactiveMode ? false : this.props.headless ),
                launcherArgs: this.props.launcherArgs,
                ...options
              },
              this.props.snippets,
              project.targets,
              {
                variables: getSelectedVariables( project.variables, activeEnv ),
                environment
              }
            ),
github rukzuk / rukzuk / app / sets / rukzuk / rz_core / modules / rz_selector_elements / assets / notlive / selectors.js View on Github external
$.each(allSelectors, function (module, selectors) {

                // only add the default "All X Modules" selector
                if (selectors === true) {
                    selectors = [];
                }

                // use id as initial moduleName
                var moduleName = module;

                // customize module name
                if (module === 'other') {
                    moduleName = i18n['selector.other'];
                } else {
                    // fetch module name, if module is an moduleId
                    var moduleInfo = CMS.getModule(module);
                    if (moduleInfo) {
                        moduleName = moduleInfo.name;
                    }

                    // add All  Modules selector
                    var allXModulesTitle = JSON.parse(JSON.stringify(i18n['selector.allXModules'])) || ['{moduleName}'];
                    Object.keys(allXModulesTitle).forEach(function (key) {
                        allXModulesTitle[key] = allXModulesTitle[key].replace('{moduleName}', moduleName);
                    });

                    var allXModulesSelector = '.' + module; // TODO: legacy modules added &.moduleId
                    selectors.unshift({title: allXModulesTitle, selector: allXModulesSelector});
                }
github dsheiko / puppetry / src / service / TestGenerator.js View on Github external
this.interactive = {
      sids: [],
      targets: {}
    };
    this.schema = schema;
    this.suite = { ...suite };
    this.projectDirectory = projectDirectory;
    this.outputDirectory = outputDirectory;
    this.snippets = { targets: {}, groups: {}, ...snippets };
    this.env = env;
    this.options = options;
    this.runner = runner; // RUNNER_PUPPETRY when embedded

    this.allTargets = Object.values({ ...sharedTargets, ...snippets.targets, ...targets });
    // resolve css prop
    this.normalizedTargets = mapSelectors( getActiveTargets( this.allTargets ) )
      //.filter( entry => !entry.ref )
      .reduce( ( carry, entry ) => {
        carry[ entry.target ] = entry;
        return carry;
      }, {});

    this.targets = this.allTargets.reduce( ( carry, entry ) => {
      carry[ entry.target ] = entry.selector;
      return carry;
    }, {});

  }
github dsheiko / puppetry / src / component / AppLayout / Main / GroupTable / TestTable / CommandTable.jsx View on Github external
mapStateToProps = ( state ) => ({
        snippets: state.snippets,
        cleanSnippets: selectors.getCleanSnippetsMemoized( state )
      }),
      // Mapping actions to the props
github dsheiko / puppetry / src / component / AppLayout.jsx View on Github external
mapStateToProps = ( state ) => ({
        store: state,
        cleanSnippets: selectors.getCleanSnippetsMemoized( state )
      }),
      // Mapping actions to the props
github dsheiko / puppetry / src / component / AppLayout / Snippets.jsx View on Github external
const mapStateToProps = ( state ) => ({
        panes: state.project.appPanels.suite.panes,
        expandedGroups: state.project.groups,
        groups: state.suite.groups,
        targets: state.suite.targets,
        targetDataTable: selectors.getSuiteTargetDataTableMemoized( state )
      }),
      // Mapping actions to the props
github dsheiko / puppetry / src / component / AppLayout / Main.jsx View on Github external
const mapStateToProps = ( state ) => ({
        panes: state.project.appPanels.suite.panes,
        expandedGroups: state.project.groups,
        groups: state.suite.groups,
        targets: state.suite.targets,
        title: state.suite.title,
        description: state.suite.description,
        timeout: state.suite.timeout,
        targetDataTable: selectors.getSuiteTargetDataTableMemoized( state ),
        groupDataTable: selectors.getSuiteGroupsMemoized( state )
      }),
      // Mapping actions to the props
github rukzuk / rukzuk / app / sets / rukzuk / rz_core / modules / rz_selector_elements / assets / notlive / selectors.js View on Github external
var getGlobalCssSelectors = function () {
        var globalSel =  {};

        globalSel.other = [{
            title: i18n['selector.allChildModules'],
            selector: ' .isModule'
        }, {
            title: i18n['selector.allFirstLevelChildModules'],
            // includes selector for modules with wrappers, e.g. rz_box and rz_grid
            selector: ' > .isModule, > :not(.isModule) > .isModule, > :not(.isModule) > :not(.isModule) > .isModule'
        }, {
            title: i18n['selector.headlines'],
            selector: ' h1, h2, h3, h4, h5, h6',
            items: [{
                title: i18n['selector.headline1'],
                selector: ' h1'
            },{
                title: i18n['selector.headline2'],
                selector: ' h2'
            },{
                title: i18n['selector.headline3'],
github rukzuk / rukzuk / app / sets / rukzuk / rz_core / modules / rz_selector_elements / assets / notlive / selectors.js View on Github external
var getGlobalCssSelectors = function () {
        var globalSel =  {};

        globalSel.other = [{
            title: i18n['selector.allChildModules'],
            selector: ' .isModule'
        }, {
            title: i18n['selector.allFirstLevelChildModules'],
            // includes selector for modules with wrappers, e.g. rz_box and rz_grid
            selector: ' > .isModule, > :not(.isModule) > .isModule, > :not(.isModule) > :not(.isModule) > .isModule'
        }, {
            title: i18n['selector.headlines'],
            selector: ' h1, h2, h3, h4, h5, h6',
            items: [{
                title: i18n['selector.headline1'],
                selector: ' h1'
            },{
                title: i18n['selector.headline2'],
                selector: ' h2'
            },{
                title: i18n['selector.headline3'],
                selector: ' h3'
            },{
                title: i18n['selector.headline4'],
github rukzuk / rukzuk / app / sets / rukzuk / rz_core / modules / rz_selector_elements / assets / notlive / selectors.js View on Github external
// use id as initial moduleName
                var moduleName = module;

                // customize module name
                if (module === 'other') {
                    moduleName = i18n['selector.other'];
                } else {
                    // fetch module name, if module is an moduleId
                    var moduleInfo = CMS.getModule(module);
                    if (moduleInfo) {
                        moduleName = moduleInfo.name;
                    }

                    // add All  Modules selector
                    var allXModulesTitle = JSON.parse(JSON.stringify(i18n['selector.allXModules'])) || ['{moduleName}'];
                    Object.keys(allXModulesTitle).forEach(function (key) {
                        allXModulesTitle[key] = allXModulesTitle[key].replace('{moduleName}', moduleName);
                    });

                    var allXModulesSelector = '.' + module; // TODO: legacy modules added &.moduleId
                    selectors.unshift({title: allXModulesTitle, selector: allXModulesSelector});
                }

                // add to list
                allModules.push([module, moduleName]);

                // save selector by module and selector config by selector
                selectorByModule[module] = [];
                selectorConfigByModule[module] = {};

                var addSelectors = function thisFn(module, moduleSelectors, hierarchy) {