How to use dir method in ng-mocks

Best JavaScript code snippet using ng-mocks

_gfxBidiSupport.js.uncompressed.js

Source:_gfxBidiSupport.js.uncompressed.js Github

copy

Full Screen

1define("dojox/gfx/_gfxBidiSupport", ["./_base", "dojo/_base/lang","dojo/_base/sniff", "dojo/dom", "dojo/_base/html", "dojo/_base/array",2 "./utils", "./shape", "./path", "dojox/string/BidiEngine"],3function(g, lang, has, dom, html, arr, utils, shapeLib, pathLib, BidiEngine){4 lang.getObject("dojox.gfx._gfxBidiSupport", true);5 /*=====6 // Prevent changes here from masking the definitions in _base.js from the doc parser7 var origG = g;8 g = {};9 =====*/10 switch (g.renderer){11 case 'vml':12 g.isVml = true;13 break;14 case 'svg':15 g.isSvg = true;16 if(g.svg.useSvgWeb){17 g.isSvgWeb = true;18 }19 break;20 case 'silverlight':21 g.isSilverlight = true;22 break;23 case 'canvas':24 case 'canvasWithEvents':25 g.isCanvas = true;26 break;27 }28 var bidi_const = {29 LRM : '\u200E',30 LRE : '\u202A',31 PDF : '\u202C',32 RLM : '\u200f',33 RLE : '\u202B'34 };35 /*===== g = origG; =====*/36 // the object that performs text transformations.37 var bidiEngine = new BidiEngine();38 lang.extend(g.shape.Surface, {39 // textDir: String40 // Will be used as default for Text/TextPath/Group objects that created by this surface41 // and textDir wasn't directly specified for them, though the bidi support was loaded.42 // Can be set in two ways:43 //44 // 1. When the surface is created and textDir value passed to it as fourth45 // parameter.46 // 2. Using the setTextDir(String) function, when this function is used the value47 // of textDir propagates to all of it's children and the children of children (for Groups) etc.48 textDir: "",49 setTextDir: function(/*String*/newTextDir){50 // summary:51 // Used for propagation and change of textDir.52 // newTextDir will be forced as textDir for all of it's children (Group/Text/TextPath).53 setTextDir(this, newTextDir);54 },55 getTextDir: function(){56 return this.textDir;57 }58 });59 lang.extend(g.Group, { 60 // textDir: String61 // Will be used for inheritance, or as default for text objects62 // that textDir wasn't directly specified for them but the bidi support was required.63 textDir: "",64 setTextDir: function(/*String*/newTextDir){65 // summary:66 // Used for propagation and change of textDir.67 // newTextDir will be forced as textDir for all of it's children (Group/Text/TextPath).68 setTextDir(this, newTextDir);69 },70 getTextDir: function(){71 return this.textDir;72 } 73 });74 75 lang.extend(g.Text, { 76 // summary:77 // Overrides some of dojox/gfx.Text properties, and adds some78 // for bidi support.79 80 // textDir: String81 // Used for displaying bidi scripts in right layout.82 // Defines the base direction of text that displayed, can have 3 values:83 //84 // 1. "ltr" - base direction is left to right.85 // 2. "rtl" - base direction is right to left.86 // 3. "auto" - base direction is contextual (defined by first strong character).87 textDir: "",88 formatText: function (/*String*/ text, /*String*/ textDir){89 // summary:90 // Applies the right transform on text, according to renderer.91 // text: 92 // the string for manipulation, by default return value.93 // textDir: 94 // Text direction.95 // Can be:96 //97 // 1. "ltr" - for left to right layout.98 // 2. "rtl" - for right to left layout99 // 3. "auto" - for contextual layout: the first strong letter decides the direction.100 // description:101 // Finds the right transformation that should be applied on the text, according to renderer.102 // Was tested in:103 //104 // Renderers (browser for testing):105 //106 // - canvas (FF, Chrome, Safari),107 // - vml (IE),108 // - svg (FF, Chrome, Safari, Opera),109 // - silverlight (IE, Chrome, Safari, Opera),110 // - svgWeb(FF, Chrome, Safari, Opera, IE).111 //112 // Browsers [browser version that was tested]:113 //114 // - IE [6,7,8], FF [3.6],115 // - Chrome (latest for March 2011),116 // - Safari [5.0.3],117 // - Opera [11.01].118 if(textDir && text && text.length > 1){119 var sourceDir = "ltr", targetDir = textDir;120 121 if(targetDir == "auto"){122 //is auto by default123 if(g.isVml){124 return text;125 }126 targetDir = bidiEngine.checkContextual(text);127 }128 129 if(g.isVml){130 sourceDir = bidiEngine.checkContextual(text);131 if(targetDir != sourceDir){132 if(targetDir == "rtl"){133 return !bidiEngine.hasBidiChar(text) ? bidiEngine.bidiTransform(text,"IRNNN","ILNNN") : bidi_const.RLM + bidi_const.RLM + text;134 }else{135 return bidi_const.LRM + text;136 }137 }138 return text;139 }140 141 if(g.isSvgWeb){142 if(targetDir == "rtl"){143 return bidiEngine.bidiTransform(text,"IRNNN","ILNNN");144 }145 return text;146 }147 148 if(g.isSilverlight){149 return (targetDir == "rtl") ? bidiEngine.bidiTransform(text,"IRNNN","VLYNN") : bidiEngine.bidiTransform(text,"ILNNN","VLYNN");150 }151 152 if(g.isCanvas){153 return (targetDir == "rtl") ? bidi_const.RLE + text + bidi_const.PDF : bidi_const.LRE + text + bidi_const.PDF;154 }155 156 if(g.isSvg){157 if(has("ff") < 4){158 return (targetDir == "rtl") ? bidiEngine.bidiTransform(text,"IRYNN","VLNNN") : bidiEngine.bidiTransform(text,"ILYNN","VLNNN");159 }else{160 return bidi_const.LRM + (targetDir == "rtl" ? bidi_const.RLE : bidi_const.LRE) + text + bidi_const.PDF;161 } 162 } 163 }164 return text;165 }, 166 bidiPreprocess: function(newShape){ 167 return newShape;168 }169 });170 lang.extend(g.TextPath, {171 // textDir: String172 // Used for displaying bidi scripts in right layout.173 // Defines the base direction of text that displayed, can have 3 values:174 //175 // 1. "ltr" - base direction is left to right.176 // 2. "rtl" - base direction is right to left.177 // 3. "auto" - base direction is contextual (defined by first strong character).178 textDir: "",179 formatText: function (/*String*/text, /*String*/textDir){180 // summary:181 // Applies the right transform on text, according to renderer.182 // text:183 // the string for manipulation, by default return value.184 // textDir:185 // text direction direction.186 // Can be:187 //188 // 1. "ltr" - for left to right layout.189 // 2. "rtl" - for right to left layout190 // 3. "auto" - for contextual layout: the first strong letter decides the direction.191 // description:192 // Finds the right transformation that should be applied on the text, according to renderer.193 // Was tested in:194 //195 // Renderers:196 // canvas (FF, Chrome, Safari), vml (IE), svg (FF, Chrome, Safari, Opera), silverlight (IE8), svgWeb(FF, Chrome, Safari, Opera, IE).197 //198 // Browsers:199 // IE [6,7,8], FF [3.6], Chrome (latest for February 2011), Safari [5.0.3], Opera [11.01].200 if(textDir && text && text.length > 1){201 var sourceDir = "ltr", targetDir = textDir;202 if(targetDir == "auto"){203 //is auto by default204 if(g.isVml){205 return text;206 }207 targetDir = bidiEngine.checkContextual(text);208 }209 if(g.isVml){210 sourceDir = bidiEngine.checkContextual(text);211 if(targetDir != sourceDir){212 if(targetDir == "rtl"){213 return !bidiEngine.hasBidiChar(text) ? bidiEngine.bidiTransform(text,"IRNNN","ILNNN") : bidi_const.RLM + bidi_const.RLM + text;214 }else{215 return bidi_const.LRM + text;216 }217 }218 return text;219 }220 if(g.isSvgWeb){221 if(targetDir == "rtl"){222 return bidiEngine.bidiTransform(text,"IRNNN","ILNNN");223 }224 return text;225 }226 //unlike the g.Text that is rendered in logical layout for Bidi scripts.227 //for g.TextPath in svg always visual -> bidi script is unreadable (except Opera and FF start from version 4)228 if(g.isSvg){229 if(has("opera") || has("ff") >= 4){230 text = bidi_const.LRM + (targetDir == "rtl"? bidi_const.RLE : bidi_const.LRE) + text + bidi_const.PDF;231 }else{232 text = (targetDir == "rtl") ? bidiEngine.bidiTransform(text,"IRYNN","VLNNN") : bidiEngine.bidiTransform(text,"ILYNN","VLNNN");233 }234 } 235 } 236 return text;237 },238 bidiPreprocess: function(newText){239 if(newText && (typeof newText == "string")){240 this.origText = newText;241 newText = this.formatText(newText,this.textDir);242 }243 return newText;244 }245 }); 246 247 var extendMethod = function(shape, method, before, after){248 // summary:249 // Some helper function. Used for extending methods of shape.250 // shape: Object251 // The shape we overriding it's method.252 // method: String253 // The method that is extended, the original method is called before or after254 // functions that passed to extendMethod.255 // before: function256 // If defined this function will be executed before the original method.257 // after: function258 // If defined this function will be executed after the original method.259 var old = shape.prototype[method];260 shape.prototype[method] = 261 function(){262 var rBefore;263 if (before){264 rBefore = before.apply(this, arguments);265 }266 var r = old.call(this, rBefore);267 if (after){268 r = after.call(this, r, arguments);269 }270 return r;271 };272 };273 var bidiPreprocess = function(newText){274 if (newText){ 275 if (newText.textDir){276 newText.textDir = validateTextDir(newText.textDir);277 }278 if (newText.text && (newText.text instanceof Array)){279 newText.text = newText.text.join(",");280 }281 }282 if(newText && (newText.text != undefined || newText.textDir) && (this.textDir != newText.textDir || newText.text != this.origText)){283 // store the original text. 284 this.origText = (newText.text != undefined) ? newText.text : this.origText;285 if(newText.textDir){286 this.textDir = newText.textDir;287 }288 newText.text = this.formatText(this.origText,this.textDir);289 }290 return this.bidiPreprocess(newText);291 };292 // Instead of adding bidiPreprocess to all renders one by one293 // use the extendMethod, at first there's a need for bidi transformation 294 // on text then call to original setShape.295 extendMethod(g.Text,"setShape", bidiPreprocess, null);296 extendMethod(g.TextPath,"setText", bidiPreprocess, null);297 298 var restoreText = function(origObj){299 var obj = lang.clone(origObj);300 if (obj && this.origText){301 obj.text = this.origText;302 }303 return obj;304 };305 // Instead of adding restoreText to all renders one by one306 // use the extendMethod, at first get the shape by calling the original getShape,307 // than resrore original text (without the text transformations).308 extendMethod(g.Text, "getShape", null, restoreText);309 extendMethod(g.TextPath, "getText", null, restoreText);310 var groupTextDir = function(group, args){311 var textDir;312 if (args && args[0]){313 textDir = validateTextDir(args[0]);314 }315 group.setTextDir(textDir ? textDir : this.textDir);316 return group; // dojox/gfx.Group317 };318 // In creation of Group there's a need to update it's textDir,319 // so instead of doing it in renders one by one (vml vs others)320 // use the extendMethod, at first the original createGroup is applied, the321 // groupTextDir which is setts Group's textDir as it's father's or if was defined322 // by user by this value.323 extendMethod(g.Surface, "createGroup", null, groupTextDir);324 extendMethod(g.Group, "createGroup", null, groupTextDir);325 var textDirPreprocess = function(text){326 // inherit from surface / group if textDir is defined there327 if(text){328 var textDir = text.textDir ? validateTextDir(text.textDir) : this.textDir;329 if(textDir){330 text.textDir = textDir;331 }332 }333 return text;334 };335 // In creation there's a need to some preprocess,336 // so instead of doing it in renders one by one (vml vs others)337 // use the extendMethod, at first the textDirPreprocess function handles the input338 // then the original createXXXXXX is applied.339 extendMethod(g.Surface,"createText", textDirPreprocess, null);340 extendMethod(g.Surface,"createTextPath", textDirPreprocess, null);341 extendMethod(g.Group,"createText", textDirPreprocess, null);342 extendMethod(g.Group,"createTextPath", textDirPreprocess, null);343 /*=====344 // don't mask definition of original createSurface() function from doc parser345 g = {};346 =====*/347 g.createSurface = function(parentNode, width, height, textDir) {348 var s = g[g.renderer].createSurface(parentNode, width, height);349 var tDir = validateTextDir(textDir);350 351 if(g.isSvgWeb){352 s.textDir = tDir ? tDir : html.style(dom.byId(parentNode),"direction");353 return s;354 }355 // if textDir was defined use it, else get default value.356 //s.textDir = tDir ? tDir : html.style(s.rawNode,"direction");357 if(g.isVml || g.isSvg || g.isCanvas){358 s.textDir = tDir ? tDir : html.style(s.rawNode,"direction");359 }360 if(g.isSilverlight){361 // allow this once rawNode will be able for the silverlight362 //s.textDir = tDir ? tDir : dojo.style(s.rawNode,"direction");363 s.textDir = tDir ? tDir : html.style(s._nodes[1],"direction");364 }365 366 return s;367 };368 /*===== g = origG; =====*/369 // some helper functions370 371 function setTextDir(/*Object*/ obj, /*String*/ newTextDir){372 var tDir = validateTextDir(newTextDir);373 if (tDir){374 g.utils.forEach(obj,function(e){375 if(e instanceof g.Surface || e instanceof g.Group){376 e.textDir = tDir;377 } 378 if(e instanceof g.Text){379 e.setShape({textDir: tDir});380 }381 if(e instanceof g.TextPath){382 e.setText({textDir: tDir})383 }384 }, obj);385 }386 return obj;387 }388 function validateTextDir(textDir){389 var validValues = ["ltr","rtl","auto"]; 390 if (textDir){391 textDir = textDir.toLowerCase();392 if (arr.indexOf(validValues, textDir) < 0){393 return null;394 }395 }396 return textDir;397 }398 return g; // return gfx api augmented with bidi support ...

Full Screen

Full Screen

dir.js

Source:dir.js Github

copy

Full Screen

...194 enumerable: false,195 writable: true,196 configurable: true,197});198function opendir(path, options, callback) {199 callback = typeof options === 'function' ? options : callback;200 validateCallback(callback);201 path = getValidatedPath(path);202 options = getOptions(options, {203 encoding: 'utf8'204 });205 function opendirCallback(error, handle) {206 if (error) {207 callback(error);208 } else {209 callback(null, new Dir(handle, path, options));210 }211 }212 const req = new FSReqCallback();213 req.oncomplete = opendirCallback;214 dirBinding.opendir(215 pathModule.toNamespacedPath(path),216 options.encoding,217 req218 );219}220function opendirSync(path, options) {221 path = getValidatedPath(path);222 options = getOptions(options, {223 encoding: 'utf8'224 });225 const ctx = { path };226 const handle = dirBinding.opendir(227 pathModule.toNamespacedPath(path),228 options.encoding,229 undefined,230 ctx231 );232 handleErrorFromBinding(ctx);233 return new Dir(handle, path, options);234}235module.exports = {236 Dir,237 opendir,238 opendirSync...

Full Screen

Full Screen

variables.js

Source:variables.js Github

copy

Full Screen

1const gulp = require('gulp')2const browserSync = require('browser-sync').create() // Локальный сервер3const babel = require('gulp-babel')4const del = require('del')5const less = require('gulp-less') // Препроцессор Less6const concat = require('gulp-concat') // Соединение в один файл7const postcss = require('gulp-postcss')8const argv = require('yargs').argv9const gulpIf = require('gulp-if')10const autoprefixer = require('autoprefixer') // Для прописывания префиксов11// const precss = require('precss')12const rename = require('gulp-rename')13const cssnano = require('cssnano') // Для отимизации и минификации выходных стилей14const fileinclude = require("gulp-file-include")15const minify = require('gulp-minify')16const sourcemaps = require('gulp-sourcemaps')17const dirSrc = './src'18const dirDist = './dist'19const dirLess = '/less'20const dirCss = '/css'21const dirFonts = '/fonts'22const dirAssets = '/assets'23const dirImg = '/img'24const dirJs = `/js`25const dirLib = `/lib`26const dirPages = `/pages`27const dirViews = `/views`28const dirTemplates = `/template`29const dirIncludes = `/includes`30const dirFavIcon = `/favicon`31const dirs = {32 dist: {33 index: `${dirDist}`,34 html: `${dirDist}`,35 css: `${dirDist}${dirAssets}${dirCss}`,36 js: `${dirDist}${dirAssets}${dirJs}`,37 jslib: `${dirDist}${dirAssets}${dirJs}${dirLib}`,38 img: `${dirDist}${dirAssets}${dirImg}`,39 favicon: `${dirDist}${dirAssets}${dirFavIcon}`,40 fonts: `${dirDist}${dirAssets}${dirFonts}`41 },42 srcPathFull: {43 fonts: `${dirSrc}${dirAssets}${dirFonts}/`,44 less: `${dirSrc}${dirAssets}${dirLess}/`,45 img: `${dirSrc}${dirAssets}${dirImg}/`,46 favicon: `${dirSrc}${dirAssets}${dirFavIcon}/`,47 },48 src: {49 index: `${dirSrc}/*.html`,50 html: [51 `${dirSrc}/**/*.html`,52 `!${dirSrc}/**/_*.html`53 ],54 less: `${dirSrc}${dirAssets}${dirLess}/style.less`,55 fonts: `${dirSrc}${dirAssets}${dirFonts}/**`,56 img: `${dirSrc}${dirAssets}${dirImg}/**`,57 favicon: `${dirSrc}${dirAssets}${dirFavIcon}/**`,58 js: [59 `${dirSrc}${dirAssets}${dirJs}/*.js`,60 ],61 vendorStyle: `${dirSrc}${dirAssets}${dirCss}/**/*.css`,62 vendorJs: [63 `${dirSrc}${dirAssets}${dirJs}${dirLib}/**/*.js`64 ]65 },66 watch: {67 index: `${dirSrc}/*.html`,68 html: `${dirSrc}/**/*.html`,69 template: `${dirSrc}${dirTemplates}/**/*.html`,70 less: `${dirSrc}${dirAssets}${dirLess}/**/*.less`,71 cssVendor: `${dirSrc}${dirAssets}${dirCss}/**/*.css`,72 img: `${dirSrc}${dirAssets}${dirImg}/**`,73 js: `${dirSrc}${dirAssets}${dirJs}/**/*.js`,74 jslib: `${dirSrc}${dirAssets}${dirJs}${dirLib}/**/*.js`,75 favicon: `${dirDist}${dirAssets}${dirFavIcon}/**`,76 }77}78module.exports = {79 // Variables path80 dirSrc,81 dirDist,82 dirLess,83 dirCss,84 dirFonts,85 dirImg,86 dirAssets,87 dirJs,88 dirViews,89 dirTemplates,90 dirPages,91 dirIncludes,92 dirFavIcon,93 dirs,94 // Plugins95 gulp,96 del,97 browserSync,98 autoprefixer,99 postcss,100 babel,101 gulpIf,102 minify,103 argv,104 less,105 concat,106 // pug,107 fileinclude,108 rename,109 cssnano,110 sourcemaps,...

Full Screen

Full Screen

direction.js

Source:direction.js Github

copy

Full Screen

1//////////////////////////////////////////////////////////////////////////////////////2// Directions3// (variables and utility functions for representing actor heading direction)4// direction enums (in counter-clockwise order)5// NOTE: changing the order of these enums may effect the enums.6// I've tried abstracting away the uses by creating functions to rotate them.7// NOTE: This order determines tie-breakers in the shortest distance turn logic.8// (i.e. higher priority turns have lower enum values)9var DIR_UP = 0;10var DIR_LEFT = 1;11var DIR_DOWN = 2;12var DIR_RIGHT = 3;13var getClockwiseAngleFromTop = function(dirEnum) {14 return -dirEnum*Math.PI/2;15};16var rotateLeft = function(dirEnum) {17 return (dirEnum+1)%4;18};19var rotateRight = function(dirEnum) {20 return (dirEnum+3)%4;21};22var rotateAboutFace = function(dirEnum) {23 return (dirEnum+2)%4;24};25// get direction enum from a direction vector26var getEnumFromDir = function(dir) {27 if (dir.x==-1) return DIR_LEFT;28 if (dir.x==1) return DIR_RIGHT;29 if (dir.y==-1) return DIR_UP;30 if (dir.y==1) return DIR_DOWN;31};32// set direction vector from a direction enum33var setDirFromEnum = function(dir,dirEnum) {34 if (dirEnum == DIR_UP) { dir.x = 0; dir.y =-1; }35 else if (dirEnum == DIR_RIGHT) { dir.x =1; dir.y = 0; }36 else if (dirEnum == DIR_DOWN) { dir.x = 0; dir.y = 1; }37 else if (dirEnum == DIR_LEFT) { dir.x = -1; dir.y = 0; }38};39// return the direction of the open, surrounding tile closest to our target40var getTurnClosestToTarget = function(tile,targetTile,openTiles) {41 var dx,dy,dist; // variables used for euclidean distance42 var minDist = Infinity; // variable used for finding minimum distance path43 var dir = {};44 var dirEnum = 0;45 var i;46 for (i=0; i<4; i++) {47 if (openTiles[i]) {48 setDirFromEnum(dir,i);49 dx = dir.x + tile.x - targetTile.x;50 dy = dir.y + tile.y - targetTile.y;51 dist = dx*dx+dy*dy;52 if (dist < minDist) {53 minDist = dist;54 dirEnum = i;55 }56 }57 }58 return dirEnum;59};60// retrieve four surrounding tiles and indicate whether they are open61var getOpenTiles = function(tile,dirEnum) {62 // get open passages63 var openTiles = {};64 openTiles[DIR_UP] = map.isFloorTile(tile.x, tile.y-1);65 openTiles[DIR_RIGHT] = map.isFloorTile(tile.x+1, tile.y);66 openTiles[DIR_DOWN] = map.isFloorTile(tile.x, tile.y+1);67 openTiles[DIR_LEFT] = map.isFloorTile(tile.x-1, tile.y);68 var numOpenTiles = 0;69 var i;70 if (dirEnum != undefined) {71 // count number of open tiles72 for (i=0; i<4; i++)73 if (openTiles[i])74 numOpenTiles++;75 // By design, no mazes should have dead ends,76 // but allow player to turn around if and only if it's necessary.77 // Only close the passage behind the player if there are other openings.78 var oppDirEnum = rotateAboutFace(dirEnum); // current opposite direction enum79 if (numOpenTiles > 1)80 openTiles[oppDirEnum] = false;81 }82 return openTiles;83};84// returns if the given tile coordinate plus the given direction vector has a walkable floor tile85var isNextTileFloor = function(tile,dir) {86 return map.isFloorTile(tile.x+dir.x,tile.y+dir.y);...

Full Screen

Full Screen

file.js

Source:file.js Github

copy

Full Screen

1/**2 * fs模块,文件操作3 */4const fs = require("fs");5let firstRun = true; // getDirTree首次执行6/**7 * 主体函数,获取目录下的文件树8 * @param {读取的路径} dir9 * @returns 返回 dir目录下的文件树10 */11function getDirTree(dir) {12 let obj = {13 dir: dir,14 childFiles: [],15 childDir: {},16 };17 let objStr = JSON.stringify(obj);18 if (firstRun && isFile(dir)) {19 return console.log(`${dir}: 不是文件夹`.redBG);20 }21 let files = readDir(dir);22 firstRun = false;23 // 遍历文件24 files.forEach((file) => {25 let tempDir = `${dir}\\${file}`;26 let dirname = getDirName(tempDir);27 let fullDir = `${dir}/${file}`;28 if (isFile(`${dir}/${file}`)) {29 obj.childFiles.push({30 short: file, // 文件名31 full: fullDir, // 完整路径32 });33 } else {34 // 在当前文件夹的对象下 childDir 属性(1),以文件夹名作为key(2),35 // (2)的值是该目录下 路径dir、childFiles子文件、childDir子文件夹组成的对象或null36 obj.childDir[dirname] = getDirTree(`${dir}/${file}`);37 }38 });39 return JSON.stringify(obj) === objStr ? null : obj;40}41/**42 * 读取路径下的文件、文件夹43 * @param {读取的路径} dir44 * @returns 返回 dir目录下的文件45 */46function readDir(dir) {47 return fs.readdirSync(dir, (err, files) => {48 if (err) throw err;49 if (firstRun && !files.length) console.log(`${dir}: 文件夹为空`.redBG);50 return files;51 });52}53/**54 * 判断制定路径是否是文件55 * @param {读取的路径} dir56 * @returns boolean57 */58function isFile(dir) {59 return fs.statSync(dir).isFile();60}61/**62 * 获取目录名63 * @param {读取的路径} dir64 * @returns 目录名65 */66function getDirName(dir) {67 return dir.substr(dir.lastIndexOf("\\") + 1, dir.length);68}69module.exports = {70 getDirTree,71 readDir,72 isFile,73 getDirName,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { dir } from 'ng-mocks';2import { TestComponent } from './test.component';3describe('TestComponent', () => {4 it('should render', () => {5 const fixture = MockRender(TestComponent);6 const debugElement = dir(fixture.debugElement, 'test');7 expect(debugElement).toBeDefined();8 });9});10import { Component } from '@angular/core';11@Component({12})13export class TestComponent {}

Full Screen

Using AI Code Generation

copy

Full Screen

1var ngMocks = require('ng-mocks');2var files = ngMocks.dir(path, options);3var ngMocks = require('ng-mocks');4var files = ngMocks.dir(path, options);5var ngMocks = require('ng-mocks');6var files = ngMocks.dir(path, options);7var ngMocks = require('ng-mocks');8var files = ngMocks.dir(path, options);9var ngMocks = require('ng-mocks');10var files = ngMocks.dir(path, options);11var ngMocks = require('ng-mocks');12var files = ngMocks.dir(path, options);13var ngMocks = require('ng-mocks');14var files = ngMocks.dir(path, options);15var ngMocks = require('ng-mocks');16var files = ngMocks.dir(path, options);17var ngMocks = require('ng-mocks');18var files = ngMocks.dir(path, options);19var ngMocks = require('ng-mocks');20var files = ngMocks.dir(path, options);21var ngMocks = require('ng-mocks');22var files = ngMocks.dir(path, options);23var ngMocks = require('ng-mocks');24var files = ngMocks.dir(path, options);25var ngMocks = require('ng-mocks');26var files = ngMocks.dir(path, options);27var ngMocks = require('ng-mocks');28var files = ngMocks.dir(path,

Full Screen

Using AI Code Generation

copy

Full Screen

1import {dir} from 'ng-mocks';2describe('dir', () => {3 it('should render a component', () => {4 const fixture = TestBed.createComponent(MyComponent);5 fixture.detectChanges();6 const component = fixture.componentInstance;7 const element = fixture.nativeElement;8 const dir = dir(element, MyDirective);9 expect(dir).toBeDefined();10 });11});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { dir } from 'ng-mocks';2const fixture = TestBed.createComponent(MyComponent);3const component = fixture.componentInstance;4const componentAsAny = component as any;5const directive = dir(component, MyDirective);6expect(directive).toBe(componentAsAny.directive);7expect(componentAsAny.directive).toBe(directive);8import { dir } from 'ng-mocks';9const fixture = TestBed.createComponent(MyComponent);10const component = fixture.componentInstance;11const componentAsAny = component as any;12const directive = dir(component, MyDirective);13expect(directive).toBe(componentAsAny.directive);14expect(componentAsAny.directive).toBe(directive);15import { dir } from 'ng-mocks';16const fixture = TestBed.createComponent(MyComponent);17const component = fixture.componentInstance;18const componentAsAny = component as any;19const directive = dir(component, MyDirective);20expect(directive).toBe(componentAsAny.directive);21expect(componentAsAny.directive).toBe(directive);22import { dir } from 'ng-mocks';23const fixture = TestBed.createComponent(MyComponent);24const component = fixture.componentInstance;25const componentAsAny = component as any;26const directive = dir(component, MyDirective);27expect(directive).toBe(componentAsAny.directive);28expect(componentAsAny.directive).toBe(directive);29import { dir } from 'ng-mocks';30const fixture = TestBed.createComponent(MyComponent);31const component = fixture.componentInstance;32const componentAsAny = component as any;33const directive = dir(component, MyDirective);34expect(directive).toBe(componentAsAny.directive);35expect(componentAsAny.directive).toBe(directive);36import { dir } from 'ng-mocks';37const fixture = TestBed.createComponent(MyComponent);38const component = fixture.componentInstance;39const componentAsAny = component as any;40const directive = dir(component, MyDirective);41expect(directive).toBe(componentAsAny.directive);42expect(componentAsAny.directive).toBe(directive);43import { dir } from 'ng-mocks';

Full Screen

Using AI Code Generation

copy

Full Screen

1import {dir} from 'ng-mocks';2const fixture = TestBed.createComponent(SomeComponent);3const component = fixture.componentInstance;4const debugElement = fixture.debugElement;5const element = debugElement.nativeElement;6const debugElement = dir(debugElement, SomeDirective);7const component = dir(debugElement, SomeComponent);8const elementRef = dir(debugElement, ElementRef);9const element = dir(debugElement, Element);10const inputElement = dir(debugElement, HTMLInputElement);11const templateRef = dir(debugElement, TemplateRef);12const viewContainerRef = dir(debugElement, ViewContainerRef);13const changeDetectorRef = dir(debugElement, ChangeDetectorRef);14const provider = dir(debugElement, SomeProvider);15const injector = dir(debugElement, Injector);16const renderer = dir(debugElement, Renderer2);17const componentFactoryResolver = dir(debugElement, ComponentFactoryResolver);18const moduleRef = dir(debugElement, NgModuleRef);19const viewRef = dir(debugElement, ViewRef);20const componentRef = dir(debugElement, ComponentRef);21const templateRef = dir(debugElement, TemplateRef);22const changeDetectorRef = dir(debugElement, ChangeDetectorRef);23const injector = dir(debugElement, Injector);24const renderer = dir(debugElement, Renderer2);25const moduleRef = dir(debugElement, NgModuleRef);26const viewRef = dir(debugElement, ViewRef);27const componentRef = dir(debugElement, ComponentRef);28const templateRef = dir(debugElement, TemplateRef);29const changeDetectorRef = dir(debugElement, ChangeDetectorRef);

Full Screen

Using AI Code Generation

copy

Full Screen

1var mock = mockModule('myModule');2var dir = mock.directive('myDirective');3var scope = dir.scope;4dir.element.html('<div>test</div>');5dir.compile();6dir.scope.$digest();7expect(dir.element.html()).toBe('<div>test</div>');8var mock = angular.mock.module('myModule');9var dir = mock.directive('myDirective');10var scope = dir.scope;11dir.element.html('<div>test</div>');12dir.compile();13dir.scope.$digest();14expect(dir.element.html()).toBe('<div>test</div>');15var mock = angular.mock.module('myModule');16var dir = mock.directive('myDirective');17var scope = dir.scope;18dir.element.html('<div>test</div>');19dir.compile();20dir.scope.$digest();21expect(dir.element.html()).toBe('<div>test</div>');22var mock = angular.mock.module('myModule');23var dir = mock.directive('myDirective');24var scope = dir.scope;25dir.element.html('<div>test</div>');26dir.compile();27dir.scope.$digest();28expect(dir.element.html()).toBe('<div>test</div>');29var mock = angular.mock.module('myModule');30var dir = mock.directive('myDirective');

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 ng-mocks 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