How to use docSrc method in Best

Best JavaScript code snippet using best

test-processor.js

Source:test-processor.js Github

copy

Full Screen

1const buffer = require('buffer');2const tap = require('tap');3const { parse, Processor } = require('../../.');4const { PassThrough } = require('stream');5tap.test('quikparse: string', test => {6 parse('<foo/>').then(test.ok).catch(test.error).then(test.done);7});8tap.test('quikparse: buffer', test => {9 parse(new Buffer('<foo/>')).then(test.ok).catch(test.error).then(test.done);10});11tap.test('quikparse: stream', test => {12 const stream = new PassThrough();13 parse(stream).then(test.ok).catch(test.error).then(test.done);14 stream.write(new Buffer('<foo/'));15 stream.write(new Buffer('>'));16 stream.end();17});18tap.test('quikparse: other', test => {19 parse(Infinity).then(test.error).catch(test.ok).then(test.done);20});21tap.test('Processor: bad target', test => {22 test.throws(() => {23 const processor = new Processor({ target: 'poop' });24 });25 test.done();26});27tap.test('Processor: default target', test => {28 const processor = new Processor();29 test.equal(processor._opts.target, 'document');30 test.done();31});32tap.test('Outside handling of nul char', test => {33 const processor = new Processor();34 processor.on('error', err => {35 test.match(err.message, 'NUL');36 test.done();37 });38 processor.end(Buffer.from('<foo\u0000/>'));39});40tap.test('Entity size limit (not exceeded)', test => {41 const docSrc = `42 <!DOCTYPE foo [43 <!ENTITY % x SYSTEM 'x'>44 %x;45 ]>46 <foo/>47 `;48 const entSrc = `<!ELEMENT foo EMPTY>`;49 const processor = new Processor({50 dereference: () => ({ entity: entSrc }),51 maxExpansionSize: 2052 });53 processor.on('ast', ast => {54 test.ok(ast);55 test.done();56 });57 processor.on('error', test.error);58 processor.end(Buffer.from(docSrc));59});60tap.test('Entity size limit (exceeded)', test => {61 const docSrc = `62 <!DOCTYPE foo [63 <!ENTITY % x SYSTEM 'x'>64 %x;65 ]>66 <foo/>67 `;68 const entSrc = `<!ELEMENT foo EMPTY>`;69 const processor = new Processor({70 dereference: () => ({ entity: entSrc }),71 maxExpansionSize: 1972 });73 processor.on('error', err => {74 test.match(err.message, 'maximum permitted size');75 test.done();76 });77 processor.end(Buffer.from(docSrc));78});79tap.test('Entity size limit (exceeded via recursion)', test => {80 const docSrc = `81 <!DOCTYPE foo [82 <!ELEMENT foo (#PCDATA)*>83 <!ENTITY bar "&baz;&baz;&baz;&baz;&baz;!">84 <!ENTITY baz "abcdefghijklmnopqrst">85 ]>86 <foo>&bar;</foo>87 `;88 const processor = new Processor({ maxExpansionSize: 100 });89 processor.on('error', err => {90 test.match(err.message, 'maximum permitted size');91 test.match(err.message, 'bar');92 test.done();93 });94 processor.end(Buffer.from(docSrc));95});96tap.test('Entity count exceeded', test => {97 const docSrc = `98 <!DOCTYPE foo [99 <!ENTITY % bar SYSTEM "bar">100 %bar;101 ]>102 <foo/>103 `;104 const entSrc = `105 <!ENTITY % baz "&#x26;#x3C;!ELEMENT foo (#PCDATA)*>">106 <!ENTITY % qux "%baz;">107 %qux;108 `;109 const processor = new Processor({110 dereference: () => ({ entity: entSrc }),111 maxExpansionCount: 2112 });113 processor.on('error', err => {114 test.match(err.message, 'maximum number');115 test.match(err.message, 'qux');116 test.done();117 });118 processor.end(Buffer.from(docSrc));119});120tap.test('Entities recurse', test => {121 const docSrc = `122 <!DOCTYPE foo [123 <!ELEMENT foo (#PCDATA)*>124 <!ENTITY bar "&baz;">125 <!ENTITY baz "&qux;">126 <!ENTITY qux "&baz;">127 ]>128 <foo>&bar;</foo>129 `;130 const processor = new Processor();131 processor.on('error', err => {132 test.match(err.message, 'recursive');133 test.match(err.message, 'bar => baz => qux => baz');134 test.done();135 });136 processor.end(Buffer.from(docSrc));137});138tap.test('Missing dereference function', test => {139 const docSrc = `140 <!DOCTYPE foo SYSTEM 'foo'>141 <foo/>142 `;143 const processor = new Processor();144 processor.on('error', err => {145 test.match(err.message, 'deref');146 test.done();147 });148 processor.end(Buffer.from(docSrc));149});150tap.test('Bad dereference value', test => {151 const docSrc = `152 <!DOCTYPE foo SYSTEM 'foo'>153 <foo/>154 `;155 const processor = new Processor({ dereference: () => ({ entity: 7 }) });156 processor.on('error', err => {157 test.match(err.message, 'deref');158 test.done();159 });160 processor.end(Buffer.from(docSrc));161});162tap.test('Alternate dereference values', test => {163 const docSrc = `164 <!DOCTYPE foo SYSTEM 'foo'>165 <foo/>166 `;167 const processor = new Processor({168 dereference: ({ systemID }) => {169 if (systemID === 'foo') {170 const stream = new PassThrough();171 Promise.resolve().then(() => {172 stream.end(Buffer.from(`<!ENTITY % bar SYSTEM 'bar'> %bar;`));173 });174 return { entity: stream };175 }176 return { entity: Buffer.from('<!ELEMENT foo EMPTY>') };177 }178 });179 processor.on('ast', ast => {180 test.ok(ast);181 test.done();182 });183 processor.end(Buffer.from(docSrc));184});185tap.test('Distinct encoding when dereferencing', test => {186 const docSrc = buffer187 .transcode(188 Buffer.from(`<!DOCTYPE foo SYSTEM 'foo'><foo/>`),189 'utf8',190 'utf16le'191 );192 const dtdSrc = buffer193 .transcode(Buffer.from('<!ELEMENT foo ANY>'), 'utf8', 'utf16le')194 .swap16();195 const processor = new Processor({196 dereference: () => ({197 encoding: 'utf16be',198 entity: dtdSrc199 }),200 encoding: 'utf16le'201 });202 processor.on('ast', ast => {203 test.ok(ast);204 test.done();205 });206 processor.end(docSrc);...

Full Screen

Full Screen

Progress.js

Source:Progress.js Github

copy

Full Screen

1import React from 'react';2import { Helmet } from 'react-helmet';3import brand from 'ba-utils/brand';4import PropTypes from 'prop-types';5import { withStyles } from '@material-ui/core/styles';6import Grid from '@material-ui/core/Grid';7import { SourceReader, PapperBlock } from './../../components';8import {9 CircularStatic,10 CircularIndeterminate,11 CircularDeterminate,12 CircularIntegration,13 LinearStatic,14 LinearIndeterminate,15 LinearDeterminate,16 LinearBuffer,17 LinearQuery,18 ProgressDelay19} from './demos';20const styles = ({21 root: {22 flexGrow: 1,23 }24});25class Progress extends React.Component {26 render() {27 const { classes } = this.props;28 const title = brand.name + ' - UI Elements';29 const description = brand.desc;30 const docSrc = 'routes/UiElements/demos/Progress/';31 return (32 <div>33 <Helmet>34 <title>{title}</title>35 <meta name="description" content={description} />36 <meta property="og:title" content={title} />37 <meta property="og:description" content={description} />38 <meta property="twitter:title" content={title} />39 <meta property="twitter:description" content={description} />40 </Helmet>41 <div className={classes.root}>42 <Grid container spacing={24}>43 <Grid item md={6} xs={12}>44 <PapperBlock title="Circular Static" desc="Progress and activity indicators are visual indications of an app loading content.">45 <div>46 <CircularStatic />47 <SourceReader componentName={docSrc + 'CircularStatic.js'} />48 </div>49 </PapperBlock>50 <PapperBlock title="Circular Determinate" desc="Indicators display how long an operation will take.">51 <div>52 <CircularDeterminate />53 <SourceReader componentName={docSrc + 'CircularDeterminate.js'} />54 </div>55 </PapperBlock>56 </Grid>57 <Grid item md={6} xs={12}>58 <PapperBlock title="Circular Indeterminate" desc="Indicators visualize an unspecified wait time.">59 <div>60 <CircularIndeterminate />61 <SourceReader componentName={docSrc + 'CircularIndeterminate.js'} />62 </div>63 </PapperBlock>64 <PapperBlock title="Circular Integration" desc="Visual indicator should be used to represent each type of operation.">65 <div>66 <CircularIntegration />67 <SourceReader componentName={docSrc + 'CircularIntegration.js'} />68 </div>69 </PapperBlock>70 </Grid>71 </Grid>72 <PapperBlock title="Linear Static" desc="">73 <div>74 <LinearStatic />75 <SourceReader componentName={docSrc + 'LinearStatic.js'} />76 </div>77 </PapperBlock>78 <Grid container spacing={24}>79 <Grid item md={6} xs={12}>80 <PapperBlock title="Linear Determinate" desc="">81 <div>82 <LinearDeterminate />83 <SourceReader componentName={docSrc + 'LinearDeterminate.js'} />84 </div>85 </PapperBlock>86 <PapperBlock title="Linear Buffer" desc="">87 <div>88 <LinearBuffer />89 <SourceReader componentName={docSrc + 'LinearBuffer.js'} />90 </div>91 </PapperBlock>92 <PapperBlock title="Linear Query" desc="">93 <div>94 <LinearQuery />95 <SourceReader componentName={docSrc + 'LinearQuery.js'} />96 </div>97 </PapperBlock>98 </Grid>99 <Grid item md={6} xs={12}>100 <PapperBlock title="Linear Indeterminate" desc="">101 <div>102 <LinearIndeterminate />103 <SourceReader componentName={docSrc + 'LinearIndeterminate.js'} />104 </div>105 </PapperBlock>106 <PapperBlock title="Progress Delay Appearance" desc="There are 3 important limits to know around response time. The ripple effect of the ButtonBase component ensures that the user feels that the system is reacting instantaneously.">107 <div>108 <ProgressDelay />109 <SourceReader componentName={docSrc + 'ProgressDelay.js'} />110 </div>111 </PapperBlock>112 </Grid>113 </Grid>114 </div>115 </div>116 );117 }118}119Progress.propTypes = {120 classes: PropTypes.object.isRequired,121};...

Full Screen

Full Screen

styleguide.config.js

Source:styleguide.config.js Github

copy

Full Screen

1const { createConfig } = require('@webpack-blocks/webpack2');2const babel = require('@webpack-blocks/babel6');3const path = require('path');4module.exports = {5 sections: [6 {7 name: 'Introduction',8 content: 'docSrc/introduction.md',9 sections: [10 {11 name: 'Installation',12 content: 'docSrc/installation.md'13 }14 ]15 },16 {17 name: 'UI Components',18 content: 'docSrc/ui.md',19 components: './src/**/[A-Z]*.jsx'20 },21 {22 name: 'Validations',23 content: 'docSrc/validations.md'24 },25 {26 name: 'Examples',27 content: 'docSrc/examples.md'28 }29 ],30 styleguideComponents: {31 Wrapper: path.join(__dirname, 'docSrc/components/Wrapper')32 },33 contextDependencies: [34 path.resolve(__dirname, 'src/**/[A-Z]*.jsx')35 ],36 require: [37 path.resolve(__dirname, 'docSrc/components/setup.js')38 ],39 styleguideDir: 'docs',40 title: 'Formsy MUI',41 template: path.resolve(__dirname, 'docSrc/templates/index.html'),42 theme: {43 fontFamily: {44 base: 'Roboto, sans-serif'45 }46 },47 webpackConfig: createConfig([48 babel()49 ])...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const bestiary = require('./bestiary.js');2const fs = require('fs');3const myBestiary = new bestiary.Bestiary();4myBestiary.addMonster('Goblin', 1, 'Small', 'Humanoid', 'Goblinoid', 'Neutral Evil', 'Goblin', 7, 15, 13, 10, 8, 8, 30, 7, 7, 2, 2, 2, 4, 4, 2, 2, 2, 2);5let monsterDocSrc = myBestiary.docSrc('Goblin');6fs.writeFile('test.md', monsterDocSrc, (err) => {7 if (err) throw err;8 console.log('The file has been saved!');9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestDoc = require('./bestDoc');2var bd = new BestDoc();3var doc = bd.docSrc('test.txt');4console.log(doc);5var BestDoc = require('./bestDoc');6var bd = new BestDoc();7bd.docSrc('test.txt', function(doc){8 console.log(doc);9});10var BestDoc = require('./bestDoc');11var bd = new BestDoc();12bd.docSrc('test.txt', function(doc){13 console.log(doc);14}, function(err){15 console.log(err);16});17var BestDoc = require('./bestDoc');18var bd = new BestDoc();19bd.docSrc('test.txt', function(doc){20 console.log(doc);21}, function(err){22 console.log(err);23}, function(){24 console.log('success');25});26var BestDoc = require('./bestDoc');27var bd = new BestDoc();28bd.docSrc('test.txt', function(doc){29 console.log(doc);30}, function(err){31 console.log(err);32}, function(){33 console.log('success');34}, function(s){35 console.log(s);36});37var BestDoc = require('./bestDoc');38var bd = new BestDoc();39bd.docSrc('test.txt', function(doc){40 console.log(doc);41},

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 Best 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