How to use highlight method in SeleniumBase

Best Python code snippet using SeleniumBase

plugin.js

Source:plugin.js Github

copy

Full Screen

1import hljs from 'highlight.js'2/* highlightjs-line-numbers.js 2.6.0 | (C) 2018 Yauheni Pakala | MIT License | github.com/wcoder/highlightjs-line-numbers.js */3/* Edited by Hakim for reveal.js; removed async timeout */4!function(n,e){"use strict";function t(){var n=e.createElement("style");n.type="text/css",n.innerHTML=g(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[v,L,b]),e.getElementsByTagName("head")[0].appendChild(n)}function r(t){"interactive"===e.readyState||"complete"===e.readyState?i(t):n.addEventListener("DOMContentLoaded",function(){i(t)})}function i(t){try{var r=e.querySelectorAll("code.hljs,code.nohighlight");for(var i in r)r.hasOwnProperty(i)&&l(r[i],t)}catch(o){n.console.error("LineNumbers error: ",o)}}function l(n,e){"object"==typeof n&&f(function(){n.innerHTML=s(n,e)})}function o(n,e){if("string"==typeof n){var t=document.createElement("code");return t.innerHTML=n,s(t,e)}}function s(n,e){e=e||{singleLine:!1};var t=e.singleLine?0:1;return c(n),a(n.innerHTML,t)}function a(n,e){var t=u(n);if(""===t[t.length-1].trim()&&t.pop(),t.length>e){for(var r="",i=0,l=t.length;i<l;i++)r+=g('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[j,m,L,b,p,i+1,t[i].length>0?t[i]:" "]);return g('<table class="{0}">{1}</table>',[v,r])}return n}function c(n){var e=n.childNodes;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];h(r.textContent)>0&&(r.childNodes.length>0?c(r):d(r.parentNode))}}function d(n){var e=n.className;if(/hljs-/.test(e)){for(var t=u(n.innerHTML),r=0,i="";r<t.length;r++){var l=t[r].length>0?t[r]:" ";i+=g('<span class="{0}">{1}</span>\n',[e,l])}n.innerHTML=i.trim()}}function u(n){return 0===n.length?[]:n.split(y)}function h(n){return(n.trim().match(y)||[]).length}function f(e){e()}function g(n,e){return n.replace(/\{(\d+)\}/g,function(n,t){return e[t]?e[t]:n})}var v="hljs-ln",m="hljs-ln-line",p="hljs-ln-code",j="hljs-ln-numbers",L="hljs-ln-n",b="data-line-number",y=/\r\n|\r|\n/g;hljs?(hljs.initLineNumbersOnLoad=r,hljs.lineNumbersBlock=l,hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);5/*!6 * reveal.js plugin that adds syntax highlight support.7 */8const Plugin = {9 id: 'highlight',10 HIGHLIGHT_STEP_DELIMITER: '|',11 HIGHLIGHT_LINE_DELIMITER: ',',12 HIGHLIGHT_LINE_RANGE_DELIMITER: '-',13 hljs: hljs,14 /**15 * Highlights code blocks withing the given deck.16 *17 * Note that this can be called multiple times if18 * there are multiple presentations on one page.19 *20 * @param {Reveal} reveal the reveal.js instance21 */22 init: function( reveal ) {23 // Read the plugin config options and provide fallbacks24 var config = reveal.getConfig().highlight || {};25 config.highlightOnLoad = typeof config.highlightOnLoad === 'boolean' ? config.highlightOnLoad : true;26 config.escapeHTML = typeof config.escapeHTML === 'boolean' ? config.escapeHTML : true;27 [].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( function( block ) {28 // Trim whitespace if the "data-trim" attribute is present29 if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) {30 block.innerHTML = betterTrim( block );31 }32 // Escape HTML tags unless the "data-noescape" attrbute is present33 if( config.escapeHTML && !block.hasAttribute( 'data-noescape' )) {34 block.innerHTML = block.innerHTML.replace( /</g,"&lt;").replace(/>/g, '&gt;' );35 }36 // Re-highlight when focus is lost (for contenteditable code)37 block.addEventListener( 'focusout', function( event ) {38 hljs.highlightBlock( event.currentTarget );39 }, false );40 if( config.highlightOnLoad ) {41 Plugin.highlightBlock( block );42 }43 } );44 // If we're printing to PDF, scroll the code highlights of45 // all blocks in the deck into view at once46 reveal.on( 'pdf-ready', function() {47 [].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code[data-line-numbers].current-fragment' ) ).forEach( function( block ) {48 Plugin.scrollHighlightedLineIntoView( block, {}, true );49 } );50 } );51 },52 /**53 * Highlights a code block. If the <code> node has the54 * 'data-line-numbers' attribute we also generate slide55 * numbers.56 *57 * If the block contains multiple line highlight steps,58 * we clone the block and create a fragment for each step.59 */60 highlightBlock: function( block ) {61 hljs.highlightBlock( block );62 // Don't generate line numbers for empty code blocks63 if( block.innerHTML.trim().length === 0 ) return;64 if( block.hasAttribute( 'data-line-numbers' ) ) {65 hljs.lineNumbersBlock( block, { singleLine: true } );66 var scrollState = { currentBlock: block };67 // If there is at least one highlight step, generate68 // fragments69 var highlightSteps = Plugin.deserializeHighlightSteps( block.getAttribute( 'data-line-numbers' ) );70 if( highlightSteps.length > 1 ) {71 // If the original code block has a fragment-index,72 // each clone should follow in an incremental sequence73 var fragmentIndex = parseInt( block.getAttribute( 'data-fragment-index' ), 10 );74 if( typeof fragmentIndex !== 'number' || isNaN( fragmentIndex ) ) {75 fragmentIndex = null;76 }77 // Generate fragments for all steps except the original block78 highlightSteps.slice(1).forEach( function( highlight ) {79 var fragmentBlock = block.cloneNode( true );80 fragmentBlock.setAttribute( 'data-line-numbers', Plugin.serializeHighlightSteps( [ highlight ] ) );81 fragmentBlock.classList.add( 'fragment' );82 block.parentNode.appendChild( fragmentBlock );83 Plugin.highlightLines( fragmentBlock );84 if( typeof fragmentIndex === 'number' ) {85 fragmentBlock.setAttribute( 'data-fragment-index', fragmentIndex );86 fragmentIndex += 1;87 }88 else {89 fragmentBlock.removeAttribute( 'data-fragment-index' );90 }91 // Scroll highlights into view as we step through them92 fragmentBlock.addEventListener( 'visible', Plugin.scrollHighlightedLineIntoView.bind( Plugin, fragmentBlock, scrollState ) );93 fragmentBlock.addEventListener( 'hidden', Plugin.scrollHighlightedLineIntoView.bind( Plugin, fragmentBlock.previousSibling, scrollState ) );94 } );95 block.removeAttribute( 'data-fragment-index' )96 block.setAttribute( 'data-line-numbers', Plugin.serializeHighlightSteps( [ highlightSteps[0] ] ) );97 }98 // Scroll the first highlight into view when the slide99 // becomes visible. Note supported in IE11 since it lacks100 // support for Element.closest.101 var slide = typeof block.closest === 'function' ? block.closest( 'section:not(.stack)' ) : null;102 if( slide ) {103 var scrollFirstHighlightIntoView = function() {104 Plugin.scrollHighlightedLineIntoView( block, scrollState, true );105 slide.removeEventListener( 'visible', scrollFirstHighlightIntoView );106 }107 slide.addEventListener( 'visible', scrollFirstHighlightIntoView );108 }109 Plugin.highlightLines( block );110 }111 },112 /**113 * Animates scrolling to the first highlighted line114 * in the given code block.115 */116 scrollHighlightedLineIntoView: function( block, scrollState, skipAnimation ) {117 cancelAnimationFrame( scrollState.animationFrameID );118 // Match the scroll position of the currently visible119 // code block120 if( scrollState.currentBlock ) {121 block.scrollTop = scrollState.currentBlock.scrollTop;122 }123 // Remember the current code block so that we can match124 // its scroll position when showing/hiding fragments125 scrollState.currentBlock = block;126 var highlightBounds = this.getHighlightedLineBounds( block )127 var viewportHeight = block.offsetHeight;128 // Subtract padding from the viewport height129 var blockStyles = getComputedStyle( block );130 viewportHeight -= parseInt( blockStyles.paddingTop ) + parseInt( blockStyles.paddingBottom );131 // Scroll position which centers all highlights132 var startTop = block.scrollTop;133 var targetTop = highlightBounds.top + ( Math.min( highlightBounds.bottom - highlightBounds.top, viewportHeight ) - viewportHeight ) / 2;134 // Account for offsets in position applied to the135 // <table> that holds our lines of code136 var lineTable = block.querySelector( '.hljs-ln' );137 if( lineTable ) targetTop += lineTable.offsetTop - parseInt( blockStyles.paddingTop );138 // Make sure the scroll target is within bounds139 targetTop = Math.max( Math.min( targetTop, block.scrollHeight - viewportHeight ), 0 );140 if( skipAnimation === true || startTop === targetTop ) {141 block.scrollTop = targetTop;142 }143 else {144 // Don't attempt to scroll if there is no overflow145 if( block.scrollHeight <= viewportHeight ) return;146 var time = 0;147 var animate = function() {148 time = Math.min( time + 0.02, 1 );149 // Update our eased scroll position150 block.scrollTop = startTop + ( targetTop - startTop ) * Plugin.easeInOutQuart( time );151 // Keep animating unless we've reached the end152 if( time < 1 ) {153 scrollState.animationFrameID = requestAnimationFrame( animate );154 }155 };156 animate();157 }158 },159 /**160 * The easing function used when scrolling.161 */162 easeInOutQuart: function( t ) {163 // easeInOutQuart164 return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t;165 },166 getHighlightedLineBounds: function( block ) {167 var highlightedLines = block.querySelectorAll( '.highlight-line' );168 if( highlightedLines.length === 0 ) {169 return { top: 0, bottom: 0 };170 }171 else {172 var firstHighlight = highlightedLines[0];173 var lastHighlight = highlightedLines[ highlightedLines.length -1 ];174 return {175 top: firstHighlight.offsetTop,176 bottom: lastHighlight.offsetTop + lastHighlight.offsetHeight177 }178 }179 },180 /**181 * Visually emphasize specific lines within a code block.182 * This only works on blocks with line numbering turned on.183 *184 * @param {HTMLElement} block a <code> block185 * @param {String} [linesToHighlight] The lines that should be186 * highlighted in this format:187 * "1" = highlights line 1188 * "2,5" = highlights lines 2 & 5189 * "2,5-7" = highlights lines 2, 5, 6 & 7190 */191 highlightLines: function( block, linesToHighlight ) {192 var highlightSteps = Plugin.deserializeHighlightSteps( linesToHighlight || block.getAttribute( 'data-line-numbers' ) );193 if( highlightSteps.length ) {194 highlightSteps[0].forEach( function( highlight ) {195 var elementsToHighlight = [];196 // Highlight a range197 if( typeof highlight.end === 'number' ) {198 elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child(n+'+highlight.start+'):nth-child(-n+'+highlight.end+')' ) );199 }200 // Highlight a single line201 else if( typeof highlight.start === 'number' ) {202 elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child('+highlight.start+')' ) );203 }204 if( elementsToHighlight.length ) {205 elementsToHighlight.forEach( function( lineElement ) {206 lineElement.classList.add( 'highlight-line' );207 } );208 block.classList.add( 'has-highlights' );209 }210 } );211 }212 },213 /**214 * Parses and formats a user-defined string of line215 * numbers to highlight.216 *217 * @example218 * Plugin.deserializeHighlightSteps( '1,2|3,5-10' )219 * // [220 * // [ { start: 1 }, { start: 2 } ],221 * // [ { start: 3 }, { start: 5, end: 10 } ]222 * // ]223 */224 deserializeHighlightSteps: function( highlightSteps ) {225 // Remove whitespace226 highlightSteps = highlightSteps.replace( /\s/g, '' );227 // Divide up our line number groups228 highlightSteps = highlightSteps.split( Plugin.HIGHLIGHT_STEP_DELIMITER );229 return highlightSteps.map( function( highlights ) {230 return highlights.split( Plugin.HIGHLIGHT_LINE_DELIMITER ).map( function( highlight ) {231 // Parse valid line numbers232 if( /^[\d-]+$/.test( highlight ) ) {233 highlight = highlight.split( Plugin.HIGHLIGHT_LINE_RANGE_DELIMITER );234 var lineStart = parseInt( highlight[0], 10 ),235 lineEnd = parseInt( highlight[1], 10 );236 if( isNaN( lineEnd ) ) {237 return {238 start: lineStart239 };240 }241 else {242 return {243 start: lineStart,244 end: lineEnd245 };246 }247 }248 // If no line numbers are provided, no code will be highlighted249 else {250 return {};251 }252 } );253 } );254 },255 /**256 * Serializes parsed line number data into a string so257 * that we can store it in the DOM.258 */259 serializeHighlightSteps: function( highlightSteps ) {260 return highlightSteps.map( function( highlights ) {261 return highlights.map( function( highlight ) {262 // Line range263 if( typeof highlight.end === 'number' ) {264 return highlight.start + Plugin.HIGHLIGHT_LINE_RANGE_DELIMITER + highlight.end;265 }266 // Single line267 else if( typeof highlight.start === 'number' ) {268 return highlight.start;269 }270 // All lines271 else {272 return '';273 }274 } ).join( Plugin.HIGHLIGHT_LINE_DELIMITER );275 } ).join( Plugin.HIGHLIGHT_STEP_DELIMITER );276 }277}278// Function to perform a better "data-trim" on code snippets279// Will slice an indentation amount on each line of the snippet (amount based on the line having the lowest indentation length)280function betterTrim(snippetEl) {281 // Helper functions282 function trimLeft(val) {283 // Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill284 return val.replace(/^[\s\uFEFF\xA0]+/g, '');285 }286 function trimLineBreaks(input) {287 var lines = input.split('\n');288 // Trim line-breaks from the beginning289 for (var i = 0; i < lines.length; i++) {290 if (lines[i].trim() === '') {291 lines.splice(i--, 1);292 } else break;293 }294 // Trim line-breaks from the end295 for (var i = lines.length-1; i >= 0; i--) {296 if (lines[i].trim() === '') {297 lines.splice(i, 1);298 } else break;299 }300 return lines.join('\n');301 }302 // Main function for betterTrim()303 return (function(snippetEl) {304 var content = trimLineBreaks(snippetEl.innerHTML);305 var lines = content.split('\n');306 // Calculate the minimum amount to remove on each line start of the snippet (can be 0)307 var pad = lines.reduce(function(acc, line) {308 if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {309 return line.length - trimLeft(line).length;310 }311 return acc;312 }, Number.POSITIVE_INFINITY);313 // Slice each line with this amount314 return lines.map(function(line, index) {315 return line.slice(pad);316 })317 .join('\n');318 })(snippetEl);319}...

Full Screen

Full Screen

highlight.js

Source:highlight.js Github

copy

Full Screen

...136 highlight.shape.setOptions(highlight.opts);137 // we can use this if we don't care about other options changing : highlight.shape.setRadius(highlight.opts.radiusInMeters)138 }139 else {140 highlight.shape = Drupal.gmap.factory.highlight(jQuery.extend({}, highlight.opts, {radius: highlight.opts.radiusInMeters})); // only pass radiusinmeters to g.m.circle. We keep the pixel radius in case we need to calculate again after a zoom141 }142 };143 highlightOverlay.prototype.activateHighlight = function (highlight) {144 if (!highlight.shape) {145 this.configHighlight(highlight);146 this.calculateHighlight(highlight);147 }148 highlight.shape.setMap(this.map);149 };150 highlightOverlay.prototype.deactivateHighlight = function (highlight) {151 if (highlight.shape) {152 highlight.shape.setMap(null);153 }154 };...

Full Screen

Full Screen

chart-js.demo.js

Source:chart-js.demo.js Github

copy

Full Screen

1/* 2Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.53Version: 1.9.04Author: Sean Ngu5Website: http://www.seantheme.com/color-admin-v1.9/admin/6*/78// white9var white = 'rgba(255,255,255,1.0)';10var fillBlack = 'rgba(45, 53, 60, 0.6)';11var fillBlackLight = 'rgba(45, 53, 60, 0.2)';12var strokeBlack = 'rgba(45, 53, 60, 0.8)';13var highlightFillBlack = 'rgba(45, 53, 60, 0.8)';14var highlightStrokeBlack = 'rgba(45, 53, 60, 1)';1516// blue17var fillBlue = 'rgba(52, 143, 226, 0.6)';18var fillBlueLight = 'rgba(52, 143, 226, 0.2)';19var strokeBlue = 'rgba(52, 143, 226, 0.8)';20var highlightFillBlue = 'rgba(52, 143, 226, 0.8)';21var highlightStrokeBlue = 'rgba(52, 143, 226, 1)';2223// grey24var fillGrey = 'rgba(182, 194, 201, 0.6)';25var fillGreyLight = 'rgba(182, 194, 201, 0.2)';26var strokeGrey = 'rgba(182, 194, 201, 0.8)';27var highlightFillGrey = 'rgba(182, 194, 201, 0.8)';28var highlightStrokeGrey = 'rgba(182, 194, 201, 1)';2930// green31var fillGreen = 'rgba(0, 172, 172, 0.6)';32var fillGreenLight = 'rgba(0, 172, 172, 0.2)';33var strokeGreen = 'rgba(0, 172, 172, 0.8)';34var highlightFillGreen = 'rgba(0, 172, 172, 0.8)';35var highlightStrokeGreen = 'rgba(0, 172, 172, 1)';3637// purple38var fillPurple = 'rgba(114, 124, 182, 0.6)';39var fillPurpleLight = 'rgba(114, 124, 182, 0.2)';40var strokePurple = 'rgba(114, 124, 182, 0.8)';41var highlightFillPurple = 'rgba(114, 124, 182, 0.8)';42var highlightStrokePurple = 'rgba(114, 124, 182, 1)';434445var randomScalingFactor = function() { 46 return Math.round(Math.random()*100)47};4849var barChartData = {50 labels : ['January','February','March','April','May','June','July'],51 datasets : [52 {53 fillColor : fillBlackLight,54 strokeColor : strokeBlack,55 highlightFill: highlightFillBlack,56 highlightStroke: highlightStrokeBlack,57 data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]58 },59 {60 fillColor : fillBlueLight,61 strokeColor : strokeBlue,62 highlightFill: highlightFillBlue,63 highlightStroke: highlightStrokeBlue,64 data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]65 }66 ]67};6869var doughnutData = [70 {71 value: 300,72 color: fillGrey,73 highlight: highlightFillGrey,74 label: 'Grey'75 },76 {77 value: 50,78 color: fillGreen,79 highlight: highlightFillGreen,80 label: 'Green'81 },82 {83 value: 100,84 color: fillBlue,85 highlight: highlightFillBlue,86 label: 'Blue'87 },88 {89 value: 40,90 color: fillPurple,91 highlight: highlightFillPurple,92 label: 'Purple'93 },94 {95 value: 120,96 color: fillBlack,97 highlight: highlightFillBlack,98 label: 'Black'99 }100];101102var lineChartData = {103 labels : ['January','February','March','April','May','June','July'],104 datasets : [105 {106 label: 'My First dataset',107 fillColor : fillBlackLight,108 strokeColor : strokeBlack,109 pointColor : strokeBlack,110 pointStrokeColor : white,111 pointHighlightFill : white,112 pointHighlightStroke : strokeBlack,113 data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]114 },115 {116 label: 'My Second dataset',117 fillColor : 'rgba(52,143,226,0.2)',118 strokeColor : 'rgba(52,143,226,1)',119 pointColor : 'rgba(52,143,226,1)',120 pointStrokeColor : '#fff',121 pointHighlightFill : '#fff',122 pointHighlightStroke : 'rgba(52,143,226,1)',123 data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]124 }125 ]126};127128var pieData = [129 {130 value: 300,131 color: strokePurple,132 highlight: highlightStrokePurple,133 label: 'Purple'134 },135 {136 value: 50,137 color: strokeBlue,138 highlight: highlightStrokeBlue,139 label: 'Blue'140 },141 {142 value: 100,143 color: strokeGreen,144 highlight: highlightStrokeGreen,145 label: 'Green'146 },147 {148 value: 40,149 color: strokeGrey,150 highlight: highlightStrokeGrey,151 label: 'Grey'152 },153 {154 value: 120,155 color: strokeBlack,156 highlight: highlightStrokeBlack,157 label: 'Black'158 }159];160161var polarData = [162 {163 value: 300,164 color: strokePurple,165 highlight: highlightStrokePurple,166 label: 'Purple'167 },168 {169 value: 50,170 color: strokeBlue,171 highlight: highlightStrokeBlue,172 label: 'Blue'173 },174 {175 value: 100,176 color: strokeGreen,177 highlight: highlightStrokeGreen,178 label: 'Green'179 },180 {181 value: 40,182 color: strokeGrey,183 highlight: highlightStrokeGrey,184 label: 'Grey'185 },186 {187 value: 120,188 color: strokeBlack,189 highlight: highlightStrokeBlack,190 label: 'Black'191 }192];193194var radarChartData = {195 labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],196 datasets: [197 {198 label: 'My First dataset',199 fillColor: 'rgba(45,53,60,0.2)',200 strokeColor: 'rgba(45,53,60,1)',201 pointColor: 'rgba(45,53,60,1)',202 pointStrokeColor: '#fff',203 pointHighlightFill: '#fff',204 pointHighlightStroke: 'rgba(45,53,60,1)',205 data: [65,59,90,81,56,55,40]206 },207 {208 label: 'My Second dataset',209 fillColor: 'rgba(52,143,226,0.2)',210 strokeColor: 'rgba(52,143,226,1)',211 pointColor: 'rgba(52,143,226,1)',212 pointStrokeColor: '#fff',213 pointHighlightFill: '#fff',214 pointHighlightStroke: 'rgba(52,143,226,1)',215 data: [28,48,40,19,96,27,100]216 }217 ]218};219220221Chart.defaults.global = {222 animation: true,223 animationSteps: 60,224 animationEasing: 'easeOutQuart',225 showScale: true,226 scaleOverride: false,227 scaleSteps: null,228 scaleStepWidth: null,229 scaleStartValue: null,230 scaleLineColor: 'rgba(0,0,0,.1)',231 scaleLineWidth: 1,232 scaleShowLabels: true,233 scaleLabel: '<%=value%>',234 scaleIntegersOnly: true,235 scaleBeginAtZero: false,236 scaleFontFamily: '"Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',237 scaleFontSize: 12,238 scaleFontStyle: 'normal',239 scaleFontColor: '#707478',240 responsive: true,241 maintainAspectRatio: true,242 showTooltips: true,243 customTooltips: false,244 tooltipEvents: ['mousemove', 'touchstart', 'touchmove'],245 tooltipFillColor: 'rgba(0,0,0,0.8)',246 tooltipFontFamily: '"Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',247 tooltipFontSize: 12,248 tooltipFontStyle: 'normal',249 tooltipFontColor: '#ccc',250 tooltipTitleFontFamily: '"Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',251 tooltipTitleFontSize: 12,252 tooltipTitleFontStyle: 'bold',253 tooltipTitleFontColor: '#fff',254 tooltipYPadding: 10,255 tooltipXPadding: 10,256 tooltipCaretSize: 8,257 tooltipCornerRadius: 3,258 tooltipXOffset: 10,259 tooltipTemplate: '<%if (label){%><%=label%>: <%}%><%= value %>',260 multiTooltipTemplate: '<%= value %>',261 onAnimationProgress: function(){},262 onAnimationComplete: function(){}263}264265var handleGenerateGraph = function(animationOption) {266 var animationOption = (animationOption) ? animationOption : false;267 268 if (!animationOption) {269 $('[data-render="chart-js"]').each(function() {270 var targetId = $(this).attr('id');271 var targetContainer = $(this).closest('div');272 $(targetContainer).empty();273 $(targetContainer).append('<canvas id="'+ targetId +'"></canvas>');274 });275 }276 var ctx = document.getElementById('line-chart').getContext('2d');277 var lineChart = new Chart(ctx).Line(lineChartData, {278 animation: animationOption279 });280 281 var ctx2 = document.getElementById('bar-chart').getContext('2d');282 var barChart = new Chart(ctx2).Bar(barChartData, {283 animation: animationOption284 });285 286 var ctx3 = document.getElementById('radar-chart').getContext('2d');287 var radarChart = new Chart(ctx3).Radar(radarChartData, {288 animation: animationOption289 });290 291 var ctx4 = document.getElementById('polar-area-chart').getContext('2d');292 var polarAreaChart = new Chart(ctx4).PolarArea(polarData, {293 animation: animationOption294 });295 296 var ctx5 = document.getElementById('pie-chart').getContext('2d');297 window.myPie = new Chart(ctx5).Pie(pieData, {298 animation: animationOption299 });300 301 var ctx6 = document.getElementById('doughnut-chart').getContext('2d');302 window.myDoughnut = new Chart(ctx6).Doughnut(doughnutData, {303 animation: animationOption304 });305};306307308var handleChartJs = function() {309 handleGenerateGraph(true);310 311 $(window).resize( function() {312 handleGenerateGraph();313 });314};315316var ChartJs = function () {317 "use strict";318 return {319 //main function320 init: function () {321 handleChartJs();322 }323 }; ...

Full Screen

Full Screen

jquery.highlightText.test.js

Source:jquery.highlightText.test.js Github

copy

Full Screen

1( function ( $ ) {2 QUnit.module( 'jquery.highlightText', QUnit.newMwEnvironment() );3 QUnit.test( 'Check', function ( assert ) {4 var $fixture,5 cases = [6 {7 desc: 'Test 001',8 text: 'Blue Öyster Cult',9 highlight: 'Blue',10 expected: '<span class="highlight">Blue</span> Öyster Cult'11 },12 {13 desc: 'Test 002',14 text: 'Blue Öyster Cult',15 highlight: 'Blue ',16 expected: '<span class="highlight">Blue</span> Öyster Cult'17 },18 {19 desc: 'Test 003',20 text: 'Blue Öyster Cult',21 highlight: 'Blue Ö',22 expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'23 },24 {25 desc: 'Test 004',26 text: 'Blue Öyster Cult',27 highlight: 'Blue Öy',28 expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'29 },30 {31 desc: 'Test 005',32 text: 'Blue Öyster Cult',33 highlight: ' Blue',34 expected: '<span class="highlight">Blue</span> Öyster Cult'35 },36 {37 desc: 'Test 006',38 text: 'Blue Öyster Cult',39 highlight: ' Blue ',40 expected: '<span class="highlight">Blue</span> Öyster Cult'41 },42 {43 desc: 'Test 007',44 text: 'Blue Öyster Cult',45 highlight: ' Blue Ö',46 expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'47 },48 {49 desc: 'Test 008',50 text: 'Blue Öyster Cult',51 highlight: ' Blue Öy',52 expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'53 },54 {55 desc: 'Test 009: Highlighter broken on starting Umlaut?',56 text: 'Österreich',57 highlight: 'Österreich',58 expected: '<span class="highlight">Österreich</span>'59 },60 {61 desc: 'Test 010: Highlighter broken on starting Umlaut?',62 text: 'Österreich',63 highlight: 'Ö',64 expected: '<span class="highlight">Ö</span>sterreich'65 },66 {67 desc: 'Test 011: Highlighter broken on starting Umlaut?',68 text: 'Österreich',69 highlight: 'Öst',70 expected: '<span class="highlight">Öst</span>erreich'71 },72 {73 desc: 'Test 012: Highlighter broken on starting Umlaut?',74 text: 'Österreich',75 highlight: 'Oe',76 expected: 'Österreich'77 },78 {79 desc: 'Test 013: Highlighter broken on punctuation mark?',80 text: 'So good. To be there',81 highlight: 'good',82 expected: 'So <span class="highlight">good</span>. To be there'83 },84 {85 desc: 'Test 014: Highlighter broken on space?',86 text: 'So good. To be there',87 highlight: 'be',88 expected: 'So good. To <span class="highlight">be</span> there'89 },90 {91 desc: 'Test 015: Highlighter broken on space?',92 text: 'So good. To be there',93 highlight: ' be',94 expected: 'So good. To <span class="highlight">be</span> there'95 },96 {97 desc: 'Test 016: Highlighter broken on space?',98 text: 'So good. To be there',99 highlight: 'be ',100 expected: 'So good. To <span class="highlight">be</span> there'101 },102 {103 desc: 'Test 017: Highlighter broken on space?',104 text: 'So good. To be there',105 highlight: ' be ',106 expected: 'So good. To <span class="highlight">be</span> there'107 },108 {109 desc: 'Test 018: en de Highlighter broken on special character at the end?',110 text: 'So good. xbß',111 highlight: 'xbß',112 expected: 'So good. <span class="highlight">xbß</span>'113 },114 {115 desc: 'Test 019: en de Highlighter broken on special character at the end?',116 text: 'So good. xbß.',117 highlight: 'xbß.',118 expected: 'So good. <span class="highlight">xbß.</span>'119 },120 {121 desc: 'Test 020: RTL he Hebrew',122 text: 'חסיד אומות העולם',123 highlight: 'חסיד אומות העולם',124 expected: '<span class="highlight">חסיד</span> <span class="highlight">אומות</span> <span class="highlight">העולם</span>'125 },126 {127 desc: 'Test 021: RTL he Hebrew',128 text: 'חסיד אומות העולם',129 highlight: 'חסי',130 expected: '<span class="highlight">חסי</span>ד אומות העולם'131 },132 {133 desc: 'Test 022: ja Japanese',134 text: '諸国民の中の正義の人',135 highlight: '諸国民の中の正義の人',136 expected: '<span class="highlight">諸国民の中の正義の人</span>'137 },138 {139 desc: 'Test 023: ja Japanese',140 text: '諸国民の中の正義の人',141 highlight: '諸国',142 expected: '<span class="highlight">諸国</span>民の中の正義の人'143 },144 {145 desc: 'Test 024: fr French text and « french quotes » (guillemets)',146 text: '« L\'oiseau est sur l’île »',147 highlight: '« L\'oiseau est sur l’île »',148 expected: '<span class="highlight">«</span> <span class="highlight">L\'oiseau</span> <span class="highlight">est</span> <span class="highlight">sur</span> <span class="highlight">l’île</span> <span class="highlight">»</span>'149 },150 {151 desc: 'Test 025: fr French text and « french quotes » (guillemets)',152 text: '« L\'oiseau est sur l’île »',153 highlight: '« L\'oise',154 expected: '<span class="highlight">«</span> <span class="highlight">L\'oise</span>au est sur l’île »'155 },156 {157 desc: 'Test 025a: fr French text and « french quotes » (guillemets) - does it match the single strings "«" and "L" separately?',158 text: '« L\'oiseau est sur l’île »',159 highlight: '« L',160 expected: '<span class="highlight">«</span> <span class="highlight">L</span>\'oiseau est sur <span class="highlight">l</span>’île »'161 },162 {163 desc: 'Test 026: ru Russian',164 text: 'Праведники мира',165 highlight: 'Праведники мира',166 expected: '<span class="highlight">Праведники</span> <span class="highlight">мира</span>'167 },168 {169 desc: 'Test 027: ru Russian',170 text: 'Праведники мира',171 highlight: 'Праве',172 expected: '<span class="highlight">Праве</span>дники мира'173 },174 {175 desc: 'Test 028 ka Georgian',176 text: 'მთავარი გვერდი',177 highlight: 'მთავარი გვერდი',178 expected: '<span class="highlight">მთავარი</span> <span class="highlight">გვერდი</span>'179 },180 {181 desc: 'Test 029 ka Georgian',182 text: 'მთავარი გვერდი',183 highlight: 'მთა',184 expected: '<span class="highlight">მთა</span>ვარი გვერდი'185 },186 {187 desc: 'Test 030 hy Armenian',188 text: 'Նոնա Գափրինդաշվիլի',189 highlight: 'Նոնա Գափրինդաշվիլի',190 expected: '<span class="highlight">Նոնա</span> <span class="highlight">Գափրինդաշվիլի</span>'191 },192 {193 desc: 'Test 031 hy Armenian',194 text: 'Նոնա Գափրինդաշվիլի',195 highlight: 'Նոն',196 expected: '<span class="highlight">Նոն</span>ա Գափրինդաշվիլի'197 },198 {199 desc: 'Test 032: th Thai',200 text: 'พอล แอร์ดิช',201 highlight: 'พอล แอร์ดิช',202 expected: '<span class="highlight">พอล</span> <span class="highlight">แอร์ดิช</span>'203 },204 {205 desc: 'Test 033: th Thai',206 text: 'พอล แอร์ดิช',207 highlight: 'พอ',208 expected: '<span class="highlight">พอ</span>ล แอร์ดิช'209 },210 {211 desc: 'Test 034: RTL ar Arabic',212 text: 'بول إيردوس',213 highlight: 'بول إيردوس',214 expected: '<span class="highlight">بول</span> <span class="highlight">إيردوس</span>'215 },216 {217 desc: 'Test 035: RTL ar Arabic',218 text: 'بول إيردوس',219 highlight: 'بو',220 expected: '<span class="highlight">بو</span>ل إيردوس'221 }222 ];223 $.each( cases, function ( i, item ) {224 $fixture = $( '<p>' ).text( item.text ).highlightText( item.highlight );225 assert.equal(226 $fixture.html(),227 // Re-parse to normalize228 $( '<p>' ).html( item.expected ).html(),229 item.desc || undefined230 );231 } );232 } );...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful