How to use getOptions method in storybook-root

Best JavaScript code snippet using storybook-root

es6OccurrencesTests.js

Source:es6OccurrencesTests.js Github

copy

Full Screen

...149 * @param {Number} end The end of thhe editor selection150 * @param {String} contentType Optional content type descriptor151 * @returns {Object} options object152 */153 function getOptions(callback, start, end, contentType) {154 return {callback: callback, selection: {start: start, end: end}, contentType: contentType};155 }156 157 describe('ES6 Occurrences Tests', function() {158 this.timeout(20000);159 before('Message the server for warm up', function(done) {160 occurrences = new Occurrences.JavaScriptOccurrences(worker);161 worker.start(done, {options:{ecmaVersion:6, sourceType:"module"}});162 });163 describe("Destructuring Assignments", function() {164 /**165 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358166 * @since 13.0167 */168 it("Simple array assignment", function(done) {169 var text = "var [a, b] = [1, 2];if(a === 10 || b === 10) {}";170 return computeOccurrences(text, getOptions(done, 5, 6), [{start:5, end:6}, {start:23, end:24}]);171 });172 /**173 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358174 * @since 13.0175 */176 it("Extrenal declaration array assignment", function(done) {177 var text = "var c, d;[c, d] = [3, 4];if(c === 10 || d === 10) {}";178 return computeOccurrences(text, getOptions(done, 4, 5), [{start:4, end:5}, {start:10, end:11}, {start:28, end:29}]);179 });180 /**181 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358182 * @since 13.0183 */184 it("Array re-assignment", function(done) {185 var text = "var e = [5, 6];var [f, g] = e;if(f === 10 || g === 10) {}";186 return computeOccurrences(text, getOptions(done, 20, 21), [{start:20, end:21}, {start:33, end:34}]);187 });188 /**189 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358190 * @since 13.0191 */192 it("Default values array assignment", function(done) {193 var text = "var [h=1, i=2] = [3, 4];if(h === 10 || i === 10) {}";194 return computeOccurrences(text, getOptions(done, 5, 6), [{start:5, end:6}, {start:27, end:28}]);195 });196 /**197 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358198 * @since 13.0199 */200 it("Array value swap array assignment", function(done) {201 var text = "var j = 2, k = 3;[j, k] = [k, j];";202 return computeOccurrences(text, getOptions(done, 4, 5), [{start:4, end:5}, {start:18, end:19}, {start:30, end:31}]);203 });204 /**205 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358206 * @since 13.0207 */208 it("Sparse array assignment", function(done) {209 var text = "[l, ,n] = [1, 2, 3, 4, 5];if(l === 10 || n === 10) {}";210 return computeOccurrences(text, getOptions(done, 1, 2), [{start:1, end:2}, {start:29, end:30}]);211 });212 /**213 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358214 * @since 13.0215 */216 it("Simple object assignment", function(done) {217 var text = "var {a, b} = {a: 1, b:2};if(a || b) {}";218 return computeOccurrences(text, getOptions(done, 5, 6), [{start:5, end:6}, {start:28, end:29}]);219 });220 /**221 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358222 * @since 13.0223 */224 it("Assignment external declaration object assignment", function(done) {225 var text = "var c, d;({c, d} = {c:1, d:2});if(c || d) {}";226 return computeOccurrences(text, getOptions(done, 4, 5), [{start:4, end:5}, {start:11, end:12}, {start:34, end:35}]);227 });228 /**229 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358230 * @since 13.0231 */232 it("Default values object assignment", function(done) {233 var text = "var {e=10, f=5} = {e: 3};if(e || f) {}";234 return computeOccurrences(text, getOptions(done, 5, 6), [{start:5, end:6}, {start:28, end:29}]);235 });236 /**237 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358238 * @since 13.0239 */240 it("Default values object assignment", function(done) {241 var text = "var {e=10, f=5} = {e: 3};if(e || f) {}";242 return computeOccurrences(text, getOptions(done, 5, 6), [{start:5, end:6}, {start:28, end:29}]);243 });244 /**245 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358246 * @since 13.0247 */248 it("Function expression default values object assignment", function(done) {249 var text = "(function fun({aa = 1, bb = { x: 0, y: 0 }, cc = 2} = {}) {console.log(aa, bb, cc);})();";250 return computeOccurrences(text, getOptions(done, 15, 17), [{start:15, end:17}, {start:71, end:73}]);251 });252 /**253 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358254 * @since 13.0255 */256 it("For-of default values object assignment", function(done) {257 var text = "for (var {aaa: a1, bbb: { ccc: c1 } } of {}) {console.log(a1, c1);}";258 return computeOccurrences(text, getOptions(done, 15, 17), [{start:15, end:17}, {start:58, end:60}]);259 });260 /**261 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=506358262 * @since 13.0263 */264 it("Let-computed key object assignment", function(done) {265 var text = 'let key = "z";let { [key]: h } = { z: "bar" };';266 return computeOccurrences(text, getOptions(done, 4, 7), [{start:4, end:7}, {start:21, end:24}]);267 });268 });269 describe("For-of", function() {270 /**271 * @since 13.0272 */273 it("Simple for-of", function(done) {274 var text = "for(a of {}) {console.log(a);}";275 return computeOccurrences(text, getOptions(done, 4, 5), [{start:4, end:5}, {start:26, end:27}]);276 });277 /**278 * @since 13.0279 */280 it("Simple for-of object variable", function(done) {281 var text = "for(a of b) {console.log(a, b);}";282 return computeOccurrences(text, getOptions(done, 4, 5), [{start:4, end:5}, {start:25, end:26}]);283 });284 });285 describe('Arrow Function', function(){286 /**287 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011288 * @since 10.0289 */290 it('arrow function expression 1', function(done) {291 var text = "n => {n.length;}";292 return computeOccurrences(text, getOptions(done, 0,1), [{start:0, end:1}, {start:6, end:7}]);293 });294 /**295 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011296 * @since 10.0297 */298 it('arrow function expression 2', function(done) {299 var text = "var n = 10; n => {n.length;}";300 return computeOccurrences(text, getOptions(done, 12,13), [{start:12, end:13}, {start:18, end:19}]);301 });302 /**303 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011304 * @since 10.0305 */306 it('arrow function expression 3', function(done) {307 var text = "n => f => {n.length;}";308 return computeOccurrences(text, getOptions(done, 11,12), [{start:0, end:1}, {start:11, end:12}]);309 });310 /**311 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011312 * @since 10.0313 */314 it('arrow function expression 4', function(done) {315 var text = "var n = 'hello'; n => f => {n.length;}";316 return computeOccurrences(text, getOptions(done, 17,18), [{start:17, end:18}, {start:28, end:29}]);317 });318 /**319 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011320 * @since 10.0321 */322 it('arrow function expression 5', function(done) {323 var text = "var n = []; n.map(n => {n.length;});";324 return computeOccurrences(text, getOptions(done, 18,18), [{start:18, end:19}, {start:24, end:25}]);325 });326 /**327 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011328 * @since 10.0329 */330 it('arrow function expression 6', function(done) {331 var text = "var n = []; n.map(n => {n.length;});";332 return computeOccurrences(text, getOptions(done, 12, 12), [{start:4, end:5}, {start:12, end:13}]);333 });334 /**335 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011336 * @since 10.0337 */338 it('arrow function expression 7', function(done) {339 var text = "var n = []; n.map(n => n => {n.length;});";340 return computeOccurrences(text, getOptions(done, 12, 12), [{start:4, end:5}, {start:12, end:13}]);341 });342 /**343 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=471011344 * @since 10.0345 */346 it('arrow function expression 8', function(done) {347 var text = "var n = []; n.map(n => n => {n.length;});";348 return computeOccurrences(text, getOptions(done, 24, 24), [{start:23, end:24}, {start:29, end:30}]);349 });350 });351 describe('Let and Const', function(){352 it('Const basic 1', function(done) {353 var text = "if (true) { const a=3; a++; }";354 return computeOccurrences(text, getOptions(done, 18, 19), [{start:18, end:19}, {start:23, end:24}]);355 });356 it('Const basic 2', function(done) {357 var text = "if (true) { const a=3; a++; }";358 return computeOccurrences(text, getOptions(done, 23, 23), [{start:18, end:19}, {start:23, end:24}]);359 });360 it('Let basic 1', function(done) {361 var text = "if (true) { let a; a=3; a++; }";362 return computeOccurrences(text, getOptions(done, 16, 17), [{start:16, end:17}, {start:19, end:20}, {start:24, end:25}]);363 });364 it('Let basic 2', function(done) {365 var text = "if (true) { let a; a=3; a++; }";366 return computeOccurrences(text, getOptions(done, 19, 19), [{start:16, end:17}, {start:19, end:20}, {start:24, end:25}]);367 });368 it('Let basic 3', function(done) {369 var text = "if (true) { let a; a=3; a++; }";370 return computeOccurrences(text, getOptions(done, 25, 25), [{start:16, end:17}, {start:19, end:20}, {start:24, end:25}]);371 });372 it('Const scoping program define 1', function(done) {373 var text = "const a; a++; { a++; } a++;";374 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}, {start:9, end:10}, {start:16, end:17}, {start:23, end:24}]);375 });376 it('Const scoping program define 2', function(done) {377 var text = "const a; a++; { a++; } a++;";378 return computeOccurrences(text, getOptions(done, 9, 10), [{start:6, end:7}, {start:9, end:10}, {start:16, end:17}, {start:23, end:24}]);379 });380 it('Const scoping program define 3', function(done) {381 var text = "const a; a++; { a++; } a++;";382 return computeOccurrences(text, getOptions(done, 17, 17), [{start:6, end:7}, {start:9, end:10}, {start:16, end:17}, {start:23, end:24}]);383 });384 it('Const scoping program define 4', function(done) {385 var text = "const a; a++; { a++; } a++;";386 return computeOccurrences(text, getOptions(done, 23, 23), [{start:6, end:7}, {start:9, end:10}, {start:16, end:17}, {start:23, end:24}]);387 });388 it('Let scoping program define 1', function(done) {389 var text = "let a; a++; { a++; } a++;";390 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}, {start:14, end:15}, {start:21, end:22}]);391 });392 it('Let scoping program define 2', function(done) {393 var text = "let a; a++; { a++; } a++;";394 return computeOccurrences(text, getOptions(done, 7, 8), [{start:4, end:5}, {start:7, end:8}, {start:14, end:15}, {start:21, end:22}]);395 });396 it('Let scoping program define 3', function(done) {397 var text = "let a; a++; { a++; } a++;";398 return computeOccurrences(text, getOptions(done, 15, 15), [{start:4, end:5}, {start:7, end:8}, {start:14, end:15}, {start:21, end:22}]);399 });400 it('Let scoping program define 4', function(done) {401 var text = "let a; a++; { a++; } a++;";402 return computeOccurrences(text, getOptions(done, 21, 21), [{start:4, end:5}, {start:7, end:8}, {start:14, end:15}, {start:21, end:22}]);403 });404 it('Const scoping block define 1', function(done) {405 var text = "a++; { const a; a++; } a++;";406 return computeOccurrences(text, getOptions(done, 1, 1), [{start:0, end:1}, {start:23, end:24}]);407 });408 it('Const scoping block define 2', function(done) {409 var text = "a++; { const a; a++; } a++;";410 return computeOccurrences(text, getOptions(done, 23, 24), [{start:0, end:1}, {start:23, end:24}]);411 });412 it('Const scoping block define 3', function(done) {413 var text = "a++; { const a; a++; } a++;";414 return computeOccurrences(text, getOptions(done, 13, 14), [{start:13, end:14}, {start:16, end:17}]);415 });416 it('Const scoping block define 4', function(done) {417 var text = "a++; { const a; a++; } a++;";418 return computeOccurrences(text, getOptions(done, 17, 17), [{start:13, end:14}, {start:16, end:17}]);419 });420 it('Let scoping block define 1', function(done) {421 var text = "a++; { let a; a++; } a++;";422 return computeOccurrences(text, getOptions(done, 1, 1), [{start:0, end:1}, {start:21, end:22}]);423 });424 it('Let scoping block define 2', function(done) {425 var text = "a++; { let a; a++; } a++;";426 return computeOccurrences(text, getOptions(done, 21, 22), [{start:0, end:1}, {start:21, end:22}]);427 });428 it('Let scoping block define 3', function(done) {429 var text = "a++; { let a; a++; } a++;";430 return computeOccurrences(text, getOptions(done, 11, 12), [{start:11, end:12}, {start:14, end:15}]);431 });432 it('Let scoping block define 4', function(done) {433 var text = "a++; { let a; a++; } a++;";434 return computeOccurrences(text, getOptions(done, 15, 15), [{start:11, end:12}, {start:14, end:15}]);435 });436 it('Let scoping with redefines 1', function(done) {437 var text = "let a; a++; { let a; a++; } let a; a++;";438 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}, {start:32, end:33}, {start:35, end:36}]);439 });440 it('Let scoping with redefines 2', function(done) {441 var text = "let a; a++; { let a; a++; } let a; a++;";442 return computeOccurrences(text, getOptions(done, 8, 8), [{start:4, end:5}, {start:7, end:8}, {start:32, end:33}, {start:35, end:36}]);443 });444 it('Let scoping with redefines 3', function(done) {445 var text = "let a; a++; { let a; a++; } let a; a++;";446 return computeOccurrences(text, getOptions(done, 32, 33), [{start:4, end:5}, {start:7, end:8}, {start:32, end:33}, {start:35, end:36}]);447 });448 it('Let scoping with redefines 4', function(done) {449 var text = "let a; a++; { let a; a++; } let a; a++;";450 return computeOccurrences(text, getOptions(done, 35, 36), [{start:4, end:5}, {start:7, end:8}, {start:32, end:33}, {start:35, end:36}]);451 });452 it('Let scoping with redefines 5', function(done) {453 var text = "let a; a++; { let a; a++; } let a; a++;";454 return computeOccurrences(text, getOptions(done, 18, 18), [{start:18, end:19}, {start:21, end:22}]);455 });456 it('Let scoping with redefines 6', function(done) {457 var text = "let a; a++; { let a; a++; } let a; a++;";458 return computeOccurrences(text, getOptions(done, 22, 22), [{start:18, end:19}, {start:21, end:22}]);459 });460 it('Let sibling scopes 1', function(done) {461 var text = "a++; { a++; } { let a; } { a++; } a++;";462 return computeOccurrences(text, getOptions(done, 0, 1), [{start:0, end:1}, {start:7, end:8}, {start:27, end:28}, {start:34, end:35}]);463 });464 it('Let sibling scopes 2', function(done) {465 var text = "a++; { a++; } { let a; } { a++; } a++;";466 return computeOccurrences(text, getOptions(done, 8, 8), [{start:0, end:1}, {start:7, end:8}, {start:27, end:28}, {start:34, end:35}]);467 });468 it('Let sibling scopes 3', function(done) {469 var text = "a++; { a++; } { let a; } { a++; } a++;";470 return computeOccurrences(text, getOptions(done, 27, 27), [{start:0, end:1}, {start:7, end:8}, {start:27, end:28}, {start:34, end:35}]);471 });472 it('Let sibling scopes 4', function(done) {473 var text = "a++; { a++; } { let a; } { a++; } a++;";474 return computeOccurrences(text, getOptions(done, 34, 35), [{start:0, end:1}, {start:7, end:8}, {start:27, end:28}, {start:34, end:35}]);475 });476 it('Let sibling scopes 5', function(done) {477 var text = "a++; { a++; } { let a; } { a++; } a++;";478 return computeOccurrences(text, getOptions(done, 20, 21), [{start:20, end:21}]);479 });480 it('Let nested scopes 1', function(done) {481 var text = "a++; { a++; { let a; a++; } }";482 return computeOccurrences(text, getOptions(done, 0, 1), [{start:0, end:1}, {start:7, end:8}]);483 });484 it('Let nested scopes 2', function(done) {485 var text = "a++; { a++; { let a; a++; } }";486 return computeOccurrences(text, getOptions(done, 7, 8), [{start:0, end:1}, {start:7, end:8}]);487 });488 it('Let nested scopes 3', function(done) {489 var text = "a++; { a++; { let a; a++; } }";490 return computeOccurrences(text, getOptions(done, 18, 19), [{start:18, end:19}, {start:21, end:22}]);491 });492 it('Let nested scopes 4', function(done) {493 var text = "a++; { a++; { let a; a++; } }";494 return computeOccurrences(text, getOptions(done, 21, 22), [{start:18, end:19}, {start:21, end:22}]);495 });496 it('Mixed var then let 1', function(done) {497 var text = "var a; a++; { let a; a++ };";498 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}]);499 });500 it('Mixed var then let 2', function(done) {501 var text = "var a; a++; { let a; a++ };";502 return computeOccurrences(text, getOptions(done, 7, 8), [{start:4, end:5}, {start:7, end:8}]);503 });504 it('Mixed var then let 3', function(done) {505 var text = "var a; a++; { let a; a++ };";506 return computeOccurrences(text, getOptions(done, 19, 19), [{start:18, end:19}, {start:21, end:22}]);507 });508 it('Mixed var then let 4', function(done) {509 var text = "var a; a++; { let a; a++ };";510 return computeOccurrences(text, getOptions(done, 21, 21), [{start:18, end:19}, {start:21, end:22}]);511 });512 it('Mixed var then const 1', function(done) {513 var text = "var a; a++; { const a; a++ };";514 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}]);515 });516 it('Mixed var then const 2', function(done) {517 var text = "var a; a++; { const a; a++ };";518 return computeOccurrences(text, getOptions(done, 7, 8), [{start:4, end:5}, {start:7, end:8}]);519 });520 it('Mixed var then const 3', function(done) {521 var text = "var a; a++; { const a; a++ };";522 return computeOccurrences(text, getOptions(done, 21, 21), [{start:20, end:21}, {start:23, end:24}]);523 });524 it('Mixed var then const 4', function(done) {525 var text = "var a; a++; { const a; a++ };";526 return computeOccurrences(text, getOptions(done, 23, 23), [{start:20, end:21}, {start:23, end:24}]);527 });528 it('Mixed let then var 1', function(done) {529 var text = "let a; a++; { var a; a++ };";530 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}]);531 });532 it('Mixed let then var 2', function(done) {533 var text = "let a; a++; { var a; a++ };";534 return computeOccurrences(text, getOptions(done, 7, 8), [{start:4, end:5}, {start:7, end:8}]);535 });536 it('Mixed let then var 3', function(done) {537 var text = "let a; a++; { var a; a++ };";538 return computeOccurrences(text, getOptions(done, 19, 19), [{start:18, end:19}, {start:21, end:22}]);539 });540 it('Mixed let then var 4', function(done) {541 var text = "let a; a++; { var a; a++ };";542 return computeOccurrences(text, getOptions(done, 21, 21), [{start:18, end:19}, {start:21, end:22}]);543 });544 it('Mixed let then const 1', function(done) {545 var text = "let a; a++; { const a; a++ };";546 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:7, end:8}]);547 });548 it('Mixed let then const 2', function(done) {549 var text = "let a; a++; { const a; a++ };";550 return computeOccurrences(text, getOptions(done, 7, 8), [{start:4, end:5}, {start:7, end:8}]);551 });552 it('Mixed let then const 3', function(done) {553 var text = "let a; a++; { const a; a++ };";554 return computeOccurrences(text, getOptions(done, 21, 21), [{start:20, end:21}, {start:23, end:24}]);555 });556 it('Mixed let then const 4', function(done) {557 var text = "let a; a++; { const a; a++ };";558 return computeOccurrences(text, getOptions(done, 23, 23), [{start:20, end:21}, {start:23, end:24}]);559 });560 it('Mixed const then var 1', function(done) {561 var text = "const a; a++; { var a; a++ };";562 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}, {start:9, end:10}]);563 });564 it('Mixed const then var 2', function(done) {565 var text = "const a; a++; { var a; a++ };";566 return computeOccurrences(text, getOptions(done, 9, 10), [{start:6, end:7}, {start:9, end:10}]);567 });568 it('Mixed const then var 3', function(done) {569 var text = "const a; a++; { var a; a++ };";570 return computeOccurrences(text, getOptions(done, 21, 21), [{start:20, end:21}, {start:23, end:24}]);571 });572 it('Mixed const then var 4', function(done) {573 var text = "const a; a++; { var a; a++ };";574 return computeOccurrences(text, getOptions(done, 23, 23), [{start:20, end:21}, {start:23, end:24}]);575 });576 it('Mixed const then let 1', function(done) {577 var text = "const a; a++; { let a; a++ };";578 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}, {start:9, end:10}]);579 });580 it('Mixed const then let 2', function(done) {581 var text = "const a; a++; { let a; a++ };";582 return computeOccurrences(text, getOptions(done, 9, 10), [{start:6, end:7}, {start:9, end:10}]);583 });584 it('Mixed const then let 3', function(done) {585 var text = "const a; a++; { let a; a++ };";586 return computeOccurrences(text, getOptions(done, 21, 21), [{start:20, end:21}, {start:23, end:24}]);587 });588 it('Mixed const then let 4', function(done) {589 var text = "const a; a++; { let a; a++ };";590 return computeOccurrences(text, getOptions(done, 23, 23), [{start:20, end:21}, {start:23, end:24}]);591 });592 593 /*594 * The behaviour of occurrences here is a little odd, but running this code is an error595 */596 it('Let hoisting in temporal dead zone 1', function(done) {597 var text = "{ a++; b++; let a; } a++;";598 return computeOccurrences(text, getOptions(done, 2, 2), [{start:16, end:17}]);599 });600 it('Let hoisting in temporal dead zone 2', function(done) {601 var text = "{ a++; b++; let a; } a++;";602 return computeOccurrences(text, getOptions(done, 16, 16), [{start:16, end:17}]);603 });604 });605 describe('Generators', function(){606 it('Generators 1', function(done) {607 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";608 return computeOccurrences(text, getOptions(done, 10, 10), [{start:10, end:11}, {start:62, end:63}, {start:70, end:71}]);609 });610 it('Generators 2', function(done) {611 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";612 return computeOccurrences(text, getOptions(done, 63, 63), [{start:10, end:11}, {start:62, end:63}, {start:70, end:71}]);613 });614 it('Generators 3', function(done) {615 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";616 return computeOccurrences(text, getOptions(done, 70, 71), [{start:10, end:11}, {start:62, end:63}, {start:70, end:71}]);617 });618 it('Generators 4', function(done) {619 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";620 return computeOccurrences(text, getOptions(done, 12, 13), [{start:12, end:13}, {start:23, end:24}]);621 });622 it('Generators 5', function(done) {623 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";624 return computeOccurrences(text, getOptions(done, 24, 24), [{start:12, end:13}, {start:23, end:24}]);625 });626 it('Generators 6', function(done) {627 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";628 return computeOccurrences(text, getOptions(done, 40, 41), [{start:40, end:41}, {start:76, end:77}]);629 });630 it('Generators 7', function(done) {631 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";632 return computeOccurrences(text, getOptions(done, 76, 76), [{start:40, end:41}, {start:76, end:77}]);633 });634 it('Generators 8', function(done) {635 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";636 return computeOccurrences(text, getOptions(done, 43, 43), [{start:42, end:43}, {start:52, end:53}, {start:64, end:65}]);637 });638 it('Generators 9', function(done) {639 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";640 return computeOccurrences(text, getOptions(done, 43, 43), [{start:42, end:43}, {start:52, end:53}, {start:64, end:65}]);641 });642 it('Generators 10', function(done) {643 var text = "function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);";644 return computeOccurrences(text, getOptions(done, 43, 43), [{start:42, end:43}, {start:52, end:53}, {start:64, end:65}]);645 });646 });647 describe('Classes and constructors', function(){648 it('Class declaration 1', function(done) {649 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";650 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}, {start:68, end:69}]);651 });652 it('Class declaration 2', function(done) {653 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";654 return computeOccurrences(text, getOptions(done, 68, 69), [{start:6, end:7}, {start:68, end:69}]);655 });656 it('Class declaration 3', function(done) {657 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";658 return computeOccurrences(text, getOptions(done, 22, 22), [{start:22, end:23}, {start:27, end:28}, {start:32, end:33}]);659 });660 it('Class declaration 4', function(done) {661 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";662 return computeOccurrences(text, getOptions(done, 28, 28), [{start:22, end:23}, {start:27, end:28}, {start:32, end:33}]);663 });664 it('Class declaration 5', function(done) {665 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";666 return computeOccurrences(text, getOptions(done, 32, 32), [{start:22, end:23}, {start:27, end:28}, {start:32, end:33}]);667 });668 // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=494056669 it.skip('Class declaration 6', function(done) {670 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";671 return computeOccurrences(text, getOptions(done, 38, 38), [{start:38, end:39}]);672 });673 it('Class declaration 7', function(done) {674 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";675 return computeOccurrences(text, getOptions(done, 40, 41), [{start:40, end:41}, {start:45, end:46}, {start:56, end:57}]);676 });677 it('Class declaration 8', function(done) {678 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";679 return computeOccurrences(text, getOptions(done, 45, 45), [{start:40, end:41}, {start:45, end:46}, {start:56, end:57}]);680 });681 it('Class declaration 9', function(done) {682 var text = "class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";683 return computeOccurrences(text, getOptions(done, 56, 56), [{start:40, end:41}, {start:45, end:46}, {start:56, end:57}]);684 });685 686 it('Class expression 1', function(done) {687 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";688 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:74, end:75}]);689 });690 it('Class expression 2', function(done) {691 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";692 return computeOccurrences(text, getOptions(done, 74, 74), [{start:4, end:5}, {start:74, end:75}]);693 });694 it('Class expression 3', function(done) {695 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";696 return computeOccurrences(text, getOptions(done, 28, 29), [{start:28, end:29}, {start:33, end:34}, {start:38, end:39}]);697 });698 it('Class expression 4', function(done) {699 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";700 return computeOccurrences(text, getOptions(done, 33, 34), [{start:28, end:29}, {start:33, end:34}, {start:38, end:39}]);701 });702 it('Class expression 5', function(done) {703 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";704 return computeOccurrences(text, getOptions(done, 39, 39), [{start:28, end:29}, {start:33, end:34}, {start:38, end:39}]);705 });706 it('Class expression 6', function(done) {707 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";708 return computeOccurrences(text, getOptions(done, 44, 44), [{start:44, end:45}]);709 });710 it('Class expression 7', function(done) {711 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";712 return computeOccurrences(text, getOptions(done, 46, 47), [{start:46, end:47}, {start:51, end:52}, {start:62, end:63}]);713 });714 it('Class expression 8', function(done) {715 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";716 return computeOccurrences(text, getOptions(done, 52, 52), [{start:46, end:47}, {start:51, end:52}, {start:62, end:63}]);717 });718 it('Class expression 9', function(done) {719 var text = "var a = class { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();";720 return computeOccurrences(text, getOptions(done, 62, 62), [{start:46, end:47}, {start:51, end:52}, {start:62, end:63}]);721 });722 723 it('Named class expression 1', function(done) {724 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";725 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:90, end:91}]);726 });727 it('Named class expression 2', function(done) {728 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";729 return computeOccurrences(text, getOptions(done, 90, 90), [{start:4, end:5}, {start:90, end:91}]);730 });731 // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=494056732 it.skip('Named class expression 3', function(done) {733 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";734 return computeOccurrences(text, getOptions(done, 14, 14), [{start:14, end:15}, {start:74, end:75}]);735 });736 // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=494056737 it.skip('Named class expression 4', function(done) {738 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";739 return computeOccurrences(text, getOptions(done, 74, 75), [{start:14, end:15}, {start:74, end:75}]);740 });741 it('Named class expression 5', function(done) {742 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";743 return computeOccurrences(text, getOptions(done, 30, 31), [{start:30, end:31}, {start:35, end:36}, {start:40, end:41}]);744 });745 it('Named class expression 6', function(done) {746 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";747 return computeOccurrences(text, getOptions(done, 35, 35), [{start:30, end:31}, {start:35, end:36}, {start:40, end:41}]);748 });749 it('Named class expression 7', function(done) {750 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";751 return computeOccurrences(text, getOptions(done, 41, 41), [{start:30, end:31}, {start:35, end:36}, {start:40, end:41}]);752 });753 // TODO Recognize method names as object properties, also https://bugs.eclipse.org/bugs/show_bug.cgi?id=494056754 it.skip('Named class expression 8', function(done) {755 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";756 return computeOccurrences(text, getOptions(done, 46, 47), [{start:46, end:47}, {start:76, end:77}]);757 });758 // TODO Recognize method names as object properties, also https://bugs.eclipse.org/bugs/show_bug.cgi?id=494056759 it.skip('Named class expression 9', function(done) {760 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";761 return computeOccurrences(text, getOptions(done, 77, 77), [{start:46, end:47}, {start:76, end:77}]);762 });763 it('Named class expression 10', function(done) {764 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";765 return computeOccurrences(text, getOptions(done, 48, 49), [{start:48, end:49}, {start:53, end:54}, {start:64, end:65}]);766 });767 it('Named class expression 11', function(done) {768 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";769 return computeOccurrences(text, getOptions(done, 48, 49), [{start:48, end:49}, {start:53, end:54}, {start:64, end:65}]);770 });771 it('Named class expression 12', function(done) {772 var text = "var a = class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } z(){ a.a(); } }; new a();";773 return computeOccurrences(text, getOptions(done, 48, 49), [{start:48, end:49}, {start:53, end:54}, {start:64, end:65}]);774 });775 776 it('Class declaration this occurrence 1', function(done) {777 var text = "this.a(); class z { a(){} b(){ this.a(); } }; new z(); this.a();";778 return computeOccurrences(text, getOptions(done, 2, 2), [{start:0, end:4}, {start:55, end:59}]);779 });780 it('Class declaration this occurrence 2', function(done) {781 var text = "this.a(); class z { a(){} b(){ this.a(); } }; new z(); this.a();";782 return computeOccurrences(text, getOptions(done, 33, 34), [{start:31, end:35}]);783 });784 it('Class declaration this occurrence 3', function(done) {785 var text = "this.a(); class z { a(){} b(){ this.a(); } }; new z(); this.a();";786 return computeOccurrences(text, getOptions(done, 59, 59), [{start:0, end:4}, {start:55, end:59}]);787 });788 it('Class expression this occurrence 1', function(done) {789 var text = "this.a(); var z = class { a(){} b(){ this.a(); } }; new z(); this.a();";790 return computeOccurrences(text, getOptions(done, 2, 2), [{start:0, end:4}, {start:61, end:65}]);791 });792 it('Class expression this occurrence 2', function(done) {793 var text = "this.a(); var z = class { a(){} b(){ this.a(); } }; new z(); this.a();";794 return computeOccurrences(text, getOptions(done, 39, 40), [{start:37, end:41}]);795 });796 it('Class expression this occurrence 3', function(done) {797 var text = "this.a(); var z = class { a(){} b(){ this.a(); } }; new z(); this.a();";798 return computeOccurrences(text, getOptions(done, 61, 65), [{start:0, end:4}, {start:61, end:65}]);799 });800 801 it('Extends class 1', function(done) {802 var text = "class a{}; class b extends a{};";803 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}, {start:27, end:28}]);804 });805 it('Extends class 2', function(done) {806 var text = "class a{}; class b extends a{};";807 return computeOccurrences(text, getOptions(done, 27, 27), [{start:6, end:7}, {start:27, end:28}]);808 });809 it('Extends function 1', function(done) {810 var text = "function a(){}; class b extends a{};";811 return computeOccurrences(text, getOptions(done, 9, 9), [{start:9, end:10}, {start:32, end:33}]);812 });813 it('Extends function 2', function(done) {814 var text = "function a(){}; class b extends a{};";815 return computeOccurrences(text, getOptions(done, 32, 32), [{start:9, end:10}, {start:32, end:33}]);816 });817 818 it('Named class declaration no spaces 1', function(done) {819 var text = "class a{}";820 return computeOccurrences(text, getOptions(done, 6, 6), [{start:6, end:7}]);821 });822 it('Named class declaration no spaces 2', function(done) {823 var text = "class a{}";824 return computeOccurrences(text, getOptions(done, 6, 7), [{start:6, end:7}]);825 });826 it('Named class declaration no spaces 3', function(done) {827 var text = "class a{}";828 return computeOccurrences(text, getOptions(done, 7, 7), [{start:6, end:7}]);829 });830 it('Named class expression no spaces 1', function(done) {831 var text = "var a = class b{};";832 return computeOccurrences(text, getOptions(done, 14, 14), [{start:14, end:15}]);833 });834 it('Named class expression no spaces 2', function(done) {835 var text = "var a = class b{};";836 return computeOccurrences(text, getOptions(done, 14, 15), [{start:14, end:15}]);837 });838 it('Named class expression no spaces 3', function(done) {839 var text = "var a = class b{};";840 return computeOccurrences(text, getOptions(done, 15, 15), [{start:14, end:15}]);841 });842 it('Named method declaration no spaces 1', function(done) {843 var text = "class a{ f(){} };";844 return computeOccurrences(text, getOptions(done, 9, 9), [{start:9, end:10}]);845 });846 it('Named method declaration no spaces 2', function(done) {847 var text = "class a{ f(){} };";848 return computeOccurrences(text, getOptions(done, 9, 10), [{start:9, end:10}]);849 });850 it('Named method declaration no spaces 3', function(done) {851 var text = "class a{ f(){} };";852 return computeOccurrences(text, getOptions(done, 10, 10), [{start:9, end:10}]);853 });854 855 // TODO Recognize method declarations as this properties, see above bugs marked TODO and the following856// it('Class declaration this property reference', function(done) {857// var text = "class z { a(){} b(){ this.a(); } }; new z();";858// return computeOccurrences(text, getOptions(done, 10, 11), [{start:10, end:11}, {start:26, end:27}]);859// });860// it('Class expression this property reference', function(done) {861// var text = "var z = class { a(){} b(){ this.a() } }; new z();";862// return computeOccurrences(text, getOptions(done, 16, 17), [{start:16, end:17}, {start:32, end:33}]);863// });864 }); 865 describe('Default parameters', function(){866 it('Func decl default param 1', function(done) {867 var text = "function myFunc(a = 4){ a++; } a = 'String';";868 return computeOccurrences(text, getOptions(done, 16, 16), [{start:16, end:17}, {start:24, end:25}]);869 });870 it('Func decl default param 2', function(done) {871 var text = "function myFunc(a = 4){ a++; } a = 'String';";872 return computeOccurrences(text, getOptions(done, 24, 24), [{start:16, end:17}, {start:24, end:25}]);873 });874 it('Func decl default param 3', function(done) {875 var text = "function myFunc(a = 4){ a++; } a = 'String';";876 return computeOccurrences(text, getOptions(done, 31, 31), [{start:31, end:32}]);877 });878 it('Reused default param 1', function(done) {879 var text = "function myFunc(a = 4, b = a){ a++; } a = 'String';";880 return computeOccurrences(text, getOptions(done, 16, 16), [{start:16, end:17}, {start:27, end:28}, {start:31, end:32}]);881 });882 it('Reused default param 2', function(done) {883 var text = "function myFunc(a = 4, b = a){ a++; } a = 'String';";884 return computeOccurrences(text, getOptions(done, 27, 27), [{start:16, end:17}, {start:27, end:28}, {start:31, end:32}]);885 });886 it('Reused default param 3', function(done) {887 var text = "function myFunc(a = 4, b = a){ a++; } a = 'String';";888 return computeOccurrences(text, getOptions(done, 31, 32), [{start:16, end:17}, {start:27, end:28}, {start:31, end:32}]);889 });890 it('Reused default param 4', function(done) {891 var text = "function myFunc(a = 4, b = a){ a++; } a = 'String';";892 return computeOccurrences(text, getOptions(done, 39, 39), [{start:38, end:39}]);893 });894 it('Reused default in expression param 1', function(done) {895 var text = "function myFunc(a = 4, b = a+1){ a++; } a = 'String';";896 return computeOccurrences(text, getOptions(done, 16, 16), [{start:16, end:17}, {start:27, end:28}, {start:33, end:34}]);897 });898 it('Reused default in expression param 2', function(done) {899 var text = "function myFunc(a = 4, b = a+1){ a++; } a = 'String';";900 return computeOccurrences(text, getOptions(done, 27, 27), [{start:16, end:17}, {start:27, end:28}, {start:33, end:34}]);901 });902 it('Reused default in expression param 3', function(done) {903 var text = "function myFunc(a = 4, b = a+1){ a++; } a = 'String';";904 return computeOccurrences(text, getOptions(done, 33, 34), [{start:16, end:17}, {start:27, end:28}, {start:33, end:34}]);905 });906 it('Reused default in expression param 4', function(done) {907 var text = "function myFunc(a = 4, b = a+1){ a++; } a = 'String';";908 return computeOccurrences(text, getOptions(done, 41, 41), [{start:40, end:41}]);909 });910 it('Func expr default param 1', function(done) {911 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";912 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:45, end:46}]);913 });914 it('Func expr default param 2', function(done) {915 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";916 return computeOccurrences(text, getOptions(done, 10, 11), [{start:10, end:11}]);917 });918 it('Func expr default param 3', function(done) {919 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";920 return computeOccurrences(text, getOptions(done, 22, 23), [{start:22, end:23}, {start:29, end:30}, {start:35, end:36}]);921 });922 it('Func expr default param 4', function(done) {923 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";924 return computeOccurrences(text, getOptions(done, 29, 29), [{start:22, end:23}, {start:29, end:30}, {start:35, end:36}]);925 });926 it('Func expr default param 5', function(done) {927 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";928 return computeOccurrences(text, getOptions(done, 35, 36), [{start:22, end:23}, {start:29, end:30}, {start:35, end:36}]);929 });930 it('Func expr default param 6', function(done) {931 var text = "var a = { a: function(a, b = a+1){ a++; } }; a++;";932 return computeOccurrences(text, getOptions(done, 46, 46), [{start:4, end:5}, {start:45, end:46}]);933 });934 it('Arrow func default param 1', function(done) {935 var text = "var a = (a = 4, b = a+1) => { a++; }; a++;";936 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:38, end:39}]);937 });938 it('Arrow func default param 2', function(done) {939 var text = "var a = (a = 4, b = a+1) => { a++; }; a++;";940 return computeOccurrences(text, getOptions(done, 9, 9), [{start:9, end:10}, {start:20, end:21}, {start:30, end:31}]);941 });942 it('Arrow func default param 3', function(done) {943 var text = "var a = (a = 4, b = a+1) => { a++; }; a++;";944 return computeOccurrences(text, getOptions(done, 20, 20), [{start:9, end:10}, {start:20, end:21}, {start:30, end:31}]);945 });946 it('Arrow func default param 4', function(done) {947 var text = "var a = (a = 4, b = a+1) => { a++; }; a++;";948 return computeOccurrences(text, getOptions(done, 30, 30), [{start:9, end:10}, {start:20, end:21}, {start:30, end:31}]);949 });950 it('Arrow func default param 5', function(done) {951 var text = "var a = (a = 4, b = a+1) => { a++; }; a++;";952 return computeOccurrences(text, getOptions(done, 38, 39), [{start:4, end:5}, {start:38, end:39}]);953 });954 });955 describe('Import / Export declaration', function(){956 it('Named import declaration 1', function(done) {957 worker.createTestFile("a", "");958 var text = "import * as myModule from \"a\"; myModule.doStuff();";959 return computeOccurrences(text, getOptions(done, 17, 17), [{start:12, end:20}, {start:31, end:39}]);960 });961 it('Named import declaration 2', function(done) {962 worker.createTestFile("a", "");963 var text = "import * as myModule from \"a\"; myModule.doStuff();";964 return computeOccurrences(text, getOptions(done, 33, 36), [{start:12, end:20}, {start:31, end:39}]);965 });966 it('Default import declaration 1', function(done) {967 worker.createTestFile("a", "");968 var text = "import myDefMod from \"a\"; myDefMod.doStuff();";969 return computeOccurrences(text, getOptions(done, 12, 12), [{start:7, end:15}, {start:26, end:34}]);970 });971 it('Default import declaration 2', function(done) {972 worker.createTestFile("a", "");973 var text = "import myDefMod from \"a\"; myDefMod.doStuff();";974 return computeOccurrences(text, getOptions(done, 30, 34), [{start:7, end:15}, {start:26, end:34}]);975 });976 it('Multiple named import declaration 1', function(done) {977 worker.createTestFile("a", "");978 var text = "import { myFunc, myVar } from \"a\"; myFunc(); var z = myVar;";979 return computeOccurrences(text, getOptions(done, 9, 15), [{start:9, end:15}, {start:35, end:41}]);980 });981 it('Multiple named import declaration 2', function(done) {982 worker.createTestFile("a", "");983 var text = "import { myFunc, myVar } from \"a\"; myFunc(); var z = myVar;";984 return computeOccurrences(text, getOptions(done, 36, 36), [{start:9, end:15}, {start:35, end:41}]);985 });986 it('Multiple named import declaration 3', function(done) {987 worker.createTestFile("a", "");988 var text = "import { myFunc, myVar } from \"a\"; myFunc(); var z = myVar;";989 return computeOccurrences(text, getOptions(done, 17, 19), [{start:17, end:22}, {start:53, end:58}]);990 });991 it('Multiple named import declaration 4', function(done) {992 worker.createTestFile("a", "");993 var text = "import { myFunc, myVar } from \"a\"; myFunc(); var z = myVar;";994 return computeOccurrences(text, getOptions(done, 54, 55), [{start:17, end:22}, {start:53, end:58}]);995 });996 it('Renamed multiple import declaration 1', function(done) {997 worker.createTestFile("a", "");998 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";999 return computeOccurrences(text, getOptions(done, 19, 21), [{start:19, end:22}, {start:49, end:52}]);1000 });1001 it('Renamed multiple import declaration 2', function(done) {1002 worker.createTestFile("a", "");1003 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1004 return computeOccurrences(text, getOptions(done, 19, 21), [{start:19, end:22}, {start:49, end:52}]);1005 });1006 it('Renamed multiple import declaration 3', function(done) {1007 worker.createTestFile("a", "");1008 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1009 return computeOccurrences(text, getOptions(done, 33, 34), [{start:33, end:36}, {start:64, end:67}]);1010 });1011 it('Renamed multiple import declaration 4', function(done) {1012 worker.createTestFile("a", "");1013 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1014 return computeOccurrences(text, getOptions(done, 65, 65), [{start:33, end:36}, {start:64, end:67}]);1015 });1016 it('Renamed multiple import declaration 5', function(done) {1017 worker.createTestFile("a", "");1018 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1019 return computeOccurrences(text, getOptions(done, 9, 15), []);1020 });1021 it('Renamed multiple import declaration 6', function(done) {1022 worker.createTestFile("a", "");1023 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1024 return computeOccurrences(text, getOptions(done, 72, 72), [{start:69, end:75}]);1025 });1026 it('Renamed multiple import declaration 7', function(done) {1027 worker.createTestFile("a", "");1028 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1029 return computeOccurrences(text, getOptions(done, 24, 26), []);1030 });1031 it('Renamed multiple import declaration 8', function(done) {1032 worker.createTestFile("a", "");1033 var text = "import { myFunc as ONE, myVar as TWO } from \"a\"; ONE(); var z = TWO; myFunc(); var z = myVar;";1034 return computeOccurrences(text, getOptions(done, 90, 90), [{start:87, end:92}]);1035 });1036 it('Hoisted named import declaration 1', function(done) {1037 worker.createTestFile("a", "");1038 var text = "localFunc(); import { myFunc } from 'a'; function localFunc(){ myFunc() };";1039 return computeOccurrences(text, getOptions(done, 26, 26), [{start:22, end:28}, {start:63, end:69}]);1040 });1041 it('Hoisted named import declaration 2', function(done) {1042 worker.createTestFile("a", "");1043 var text = "localFunc(); import { myFunc } from 'a'; function localFunc(){ myFunc() };";1044 return computeOccurrences(text, getOptions(done, 65, 65), [{start:22, end:28}, {start:63, end:69}]);1045 });1046 it('Named export 1', function(done) {1047 var text = "var a = 3; export { a }; a++;";1048 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:20, end:21}, {start:25, end:26}]);1049 });1050 it('Named export 2', function(done) {1051 var text = "var a = 3; export { a }; a++;";1052 return computeOccurrences(text, getOptions(done, 20, 21), [{start:4, end:5}, {start:20, end:21}, {start:25, end:26}]);1053 });1054 it('Named export 3', function(done) {1055 var text = "var a = 3; export { a }; a++;";1056 return computeOccurrences(text, getOptions(done, 25, 25), [{start:4, end:5}, {start:20, end:21}, {start:25, end:26}]);1057 });1058 it('Multiple named export 1', function(done) {1059 var text = "var a = 3; const b = '3'; export { a, b };";1060 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:35, end:36}]);1061 });1062 it('Multiple named export 2', function(done) {1063 var text = "var a = 3; const b = '3'; export { a, b };";1064 return computeOccurrences(text, getOptions(done, 35, 36), [{start:4, end:5}, {start:35, end:36}]);1065 });1066 it('Multiple named export 3', function(done) {1067 var text = "var a = 3; const b = '3'; export { a, b };";1068 return computeOccurrences(text, getOptions(done, 17, 18), [{start:17, end:18}, {start:38, end:39}]);1069 });1070 it('Multiple named export 4', function(done) {1071 var text = "var a = 3; const b = '3'; export { a, b };";1072 return computeOccurrences(text, getOptions(done, 39, 39), [{start:17, end:18}, {start:38, end:39}]);1073 });1074 it('Inline expression export 1', function(done) {1075 var text = "a++; export let a = 4; a++;";1076 return computeOccurrences(text, getOptions(done, 0, 0), [{start:0, end:1}, {start:16, end:17}, {start:23, end:24}]);1077 });1078 it('Inline expression export 2', function(done) {1079 var text = "a++; export let a = 4; a++;";1080 return computeOccurrences(text, getOptions(done, 16, 16), [{start:0, end:1}, {start:16, end:17}, {start:23, end:24}]);1081 });1082 it('Inline expression export 3', function(done) {1083 var text = "a++; export let a = 4; a++;";1084 return computeOccurrences(text, getOptions(done, 23, 23), [{start:0, end:1}, {start:16, end:17}, {start:23, end:24}]);1085 });1086 it('Inline expression export 1', function(done) {1087 var text = "a++; export let a = 4; a++;";1088 return computeOccurrences(text, getOptions(done, 0, 0), [{start:0, end:1}, {start:16, end:17}, {start:23, end:24}]);1089 });1090 it('Renamed export 1', function(done) {1091 var text = "var a = 3; export { a as b }; a++; b++;";1092 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:20, end:21}, {start:30, end:31}]);1093 });1094 it('Renamed export 2', function(done) {1095 var text = "var a = 3; export { a as b }; a++; b++;";1096 return computeOccurrences(text, getOptions(done, 21, 21), [{start:4, end:5}, {start:20, end:21}, {start:30, end:31}]);1097 });1098 it('Renamed export 3', function(done) {1099 var text = "var a = 3; export { a as b }; a++; b++;";1100 return computeOccurrences(text, getOptions(done, 30, 31), [{start:4, end:5}, {start:20, end:21}, {start:30, end:31}]);1101 });1102 it('Renamed export 4', function(done) {1103 var text = "var a = 3; export { a as b }; a++; b++;";1104 return computeOccurrences(text, getOptions(done, 25, 26), []);1105 });1106 it('Renamed export 5', function(done) {1107 var text = "var a = 3; export { a as b }; a++; b++;";1108 return computeOccurrences(text, getOptions(done, 35, 36), [{start:35, end:36}]);1109 });1110 it('Named function export 1', function(done) {1111 var text = "export function a(){}; a();";1112 return computeOccurrences(text, getOptions(done, 16, 17), [{start:16, end:17}, {start:23, end:24}]);1113 });1114 it('Named function export 2', function(done) {1115 var text = "export function a(){}; a();";1116 return computeOccurrences(text, getOptions(done, 23, 24), [{start:16, end:17}, {start:23, end:24}]);1117 });1118 it('Default expression export 1', function(done) {1119 var text = "var a = 3; export default a; a++;";1120 return computeOccurrences(text, getOptions(done, 4, 4), [{start:4, end:5}, {start:26, end:27}, {start:29, end:30}]);1121 });1122 it('Default expression export 2', function(done) {1123 var text = "var a = 3; export default a; a++;";1124 return computeOccurrences(text, getOptions(done, 26, 26), [{start:4, end:5}, {start:26, end:27}, {start:29, end:30}]);1125 });1126 it('Default expression export 3', function(done) {1127 var text = "var a = 3; export default a; a++;";1128 return computeOccurrences(text, getOptions(done, 29, 30), [{start:4, end:5}, {start:26, end:27}, {start:29, end:30}]);1129 });1130 it('Default named function export 1', function(done) {1131 var text = "export default function a(){}; a();";1132 return computeOccurrences(text, getOptions(done, 24, 24), [{start:24, end:25}, {start:31, end:32}]);1133 });1134 it('Default named function export 2', function(done) {1135 var text = "export default function a(){}; a();";1136 return computeOccurrences(text, getOptions(done, 32, 32), [{start:24, end:25}, {start:31, end:32}]);1137 });1138 it('From export 1', function(done) {1139 worker.createTestFile("a", "");1140 var text = "export { a, b } from 'a'; a++; b++;";1141 return computeOccurrences(text, getOptions(done, 9, 9), [{start:9, end:10}, {start:26, end:27}]);1142 });1143 it('From export 2', function(done) {1144 worker.createTestFile("a", "");1145 var text = "export { a, b } from 'a'; a++; b++;";1146 return computeOccurrences(text, getOptions(done, 26, 27), [{start:9, end:10}, {start:26, end:27}]);1147 });1148 it('From export 3', function(done) {1149 worker.createTestFile("a", "");1150 var text = "export { a, b } from 'a'; a++; b++;";1151 return computeOccurrences(text, getOptions(done, 12, 12), [{start:12, end:13}, {start:31, end:32}]);1152 });1153 it('From export 4', function(done) {1154 worker.createTestFile("a", "");1155 var text = "export { a, b } from 'a'; a++; b++;";1156 return computeOccurrences(text, getOptions(done, 32, 32), [{start:12, end:13}, {start:31, end:32}]);1157 });1158 it('Named from export 1', function(done) {1159 worker.createTestFile("a", "");1160 var text = "export { a as b } from 'a'; a++; b++;";1161 return computeOccurrences(text, getOptions(done, 9, 9), [{start:9, end:10}, {start:28, end:29}]);1162 });1163 it('Named from export 2', function(done) {1164 worker.createTestFile("a", "");1165 var text = "export { a as b } from 'a'; a++; b++;";1166 return computeOccurrences(text, getOptions(done, 28, 28), [{start:9, end:10}, {start:28, end:29}]);1167 });1168 it('Named from export 3', function(done) {1169 worker.createTestFile("a", "");1170 var text = "export { a as b } from 'a'; a++; b++;";1171 return computeOccurrences(text, getOptions(done, 14, 14), []);1172 });1173 it('Named from export 4', function(done) {1174 worker.createTestFile("a", "");1175 var text = "export { a as b } from 'a'; a++; b++;";1176 return computeOccurrences(text, getOptions(done, 33, 33), [{start:33, end:34}]);1177 });1178 });1179 describe('ES6 Occurrences Tests in HTML', function() {1180 it('HTML Arrow function expression', function(done) {1181 var text = "<html><script>n => {n.length;}</script></html>";1182 return computeOccurrences(text, getOptions(done, 14,15, 'text/html'), [{start:14, end:15}, {start:20, end:21}]);1183 });1184 it('HTML Let basic', function(done) {1185 var text = "<html><script>if (true) { let a; a=3; a++; }</script></html>";1186 return computeOccurrences(text, getOptions(done, 33,33, 'text/html'), [{start:30, end:31}, {start:33, end:34}, {start:38, end:39}]);1187 });1188 it('HTML Const scoping block define', function(done) {1189 var text = "<html><script>a++; { const a; a++; } a++;</script></html>";1190 return computeOccurrences(text, getOptions(done, 27,28, 'text/html'), [{start:27, end:28}, {start:30, end:31}]);1191 });1192 it('HTML Generators', function(done) {1193 var text = "<html><script>function* a(a) { yield a+1; } function* b(b){ yield b; yield* a(b); } a(1); b(1);</script></html>";1194 return computeOccurrences(text, getOptions(done, 57,57, 'text/html'), [{start:56, end:57}, {start:66, end:67}, {start:78, end:79}]);1195 });1196 it('HTML Class declaration', function(done) {1197 var text = "<html><script>class a { constructor(a, b=a) { a++ } a(a, b=a){ return a; } }; new a();</script></html>";1198 return computeOccurrences(text, getOptions(done, 36,36, 'text/html'), [{start:36, end:37}, {start:41, end:42}, {start:46, end:47}]);1199 });1200 it('HTML Extends class', function(done) {1201 var text = "<html><script>class a{}; class b extends a{};</script></html>";1202 return computeOccurrences(text, getOptions(done, 41,41, 'text/html'), [{start:20, end:21}, {start:41, end:42}]);1203 });1204 it('HTML Func expr default param', function(done) {1205 var text = "<html><script>var a = { a: function(a, b = a+1){ a++; } }; a++;</script></html>";1206 return computeOccurrences(text, getOptions(done, 49,50, 'text/html'), [{start:36, end:37}, {start:43, end:44}, {start:49, end:50}]);1207 });1208 it('HTML Multiple named import declaration', function(done) {1209 worker.createTestFile("a", "");1210 var text = "<html><script>import { myFunc, myVar } from \"a\"; myFunc(); var z = myVar;</script></html>";1211 return computeOccurrences(text, getOptions(done, 50,50, 'text/html'), [{start:23, end:29}, {start:49, end:55}]);1212 });1213 it('HTML From export', function(done) {1214 worker.createTestFile("a", "");1215 var text = "<html><script>export { a, b } from 'a'; a++; b++;</script></html>";1216 return computeOccurrences(text, getOptions(done, 46,46, 'text/html'), [{start:26, end:27}, {start:45, end:46}]);1217 });1218 });1219 });1220 }; ...

Full Screen

Full Screen

router.js

Source:router.js Github

copy

Full Screen

2 express = require('express'),3 router = express.Router();4// 过滤掉路径中的‘\route’5var static_root = __dirname.replace(/\\route|\/route$/, '') + '/mock';6function getOptions() {7 return {8 root: static_root,9 headers: {10 'x-timestamp': Date.now(),11 'x-sent': true12 }13 }14};15router.use(function timeLog(req, res, next) {16 console.log('Time: ', Date.now());17 next();18});19// 登录;20router.post('/mock/user/login', function (req, res) {21 console.log('登录');22 res.sendFile('/user/login.json', getOptions());23});24// 退出;25router.post('/mock/user/logout', function (req, res) {26 console.log('退出');27 res.sendFile('/user/logout.json', getOptions());28});29// 导航;30router.get('/mock/user/navigate', function (req, res) {31 console.log('导航');32 res.sendFile('/user/navigate.json', getOptions());33});34// 获取用户信息;35router.get('/mock/user/info', function (req, res) {36 console.log('获取用户信息');37 res.sendFile('/user/info.json', getOptions());38});39/*40 * 账户管理41 * */42//操作员账户列表;43router.get('/mock/user/list', function (req, res) {44 console.log('获取用户列表');45 res.sendFile('/user/list.json', getOptions());46});47//操作员账户信息修改;48router.post('/mock/user/info/update', function (req, res) {49 console.log('操作员账户信息修改');50 res.sendFile('/user/info/update.json', getOptions());51});52//操作员添加;53router.post('/mock/user/add', function (req, res) {54 console.log('操作员添加');55 res.sendFile('/user/add.json', getOptions());56});57//操作员状态更改;58router.post('/mock/user/status/update', function (req, res) {59 console.log('操作员状态更改');60 res.sendFile('/user/status/update.json', getOptions());61});62//指定ID的操作员所有权限获取;63router.get('/mock/user/privilege', function (req, res) {64 console.log('指定ID的操作员所有权限获取');65 res.sendFile('/user/privilege.json', getOptions());66});67//用户权限修改;68router.post('/mock/user/privilege/update', function (req, res) {69 console.log('用户权限修改');70 res.sendFile('/user/privilege/update.json', getOptions());71});72/*73 * 部门管理74 * */75//部门列表;76router.get('/mock/department/list', function (req, res) {77 console.log('获取部门列表');78 res.sendFile('/department/list.json', getOptions());79});80//添加部门;81router.post('/mock/department/add', function (req, res) {82 console.log('添加部门');83 res.sendFile('/department/add.json', getOptions());84});85//修改部门;86router.post('/mock/department/info/update', function (req, res) {87 console.log('修改部门');88 res.sendFile('/department/info/update.json', getOptions());89});90//部门状态更改(删除);91router.post('/mock/department/status/update', function (req, res) {92 console.log('部门状态更改(删除)');93 res.sendFile('/department/status/update.json', getOptions());94});95/*96 * 权限管理管理97 * */98//所有权限获取;99router.get('/mock/privilege/list', function (req, res) {100 console.log('所有权限获取');101 res.sendFile('/privilege/list.json', getOptions());102});103//添加权限;104router.post('/mock/privilege/add', function (req, res) {105 console.log('所有权限获取');106 res.sendFile('/privilege/add.json', getOptions());107});108//修改权限;109router.post('/mock/privilege/update', function (req, res) {110 console.log('所有权限获取');111 res.sendFile('/privilege/update.json', getOptions());112});113//获取指定ID权限的详细信息;114router.get('/mock/privilege/info', function (req, res) {115 console.log('获取指定ID权限的详细信息');116 res.sendFile('/privilege/info.json', getOptions());117});118//修改指定权限的状态;119router.post('/mock/privilege/status/update', function (req, res) {120 console.log('修改指定权限的状态');121 res.sendFile('/privilege/status/update.json', getOptions());122});123/*124 * 商贸公司管理125 * */126//商贸公司列表;127router.get('/mock/trade/list', function (req, res) {128 console.log('商贸公司列表');129 res.sendFile('/trade/list.json', getOptions());130});131//商贸公司添加;132router.post('/mock/trade/add', function (req, res) {133 console.log('商贸公司添加');134 res.sendFile('/trade/add.json', getOptions());135});136//商贸公司信息获取;137router.get('/mock/trade/info', function (req, res) {138 console.log('商贸公司信息获取');139 res.sendFile('/trade/info.json', getOptions());140});141//商贸公司信息修改;142router.post('/mock/trade/info/update', function (req, res) {143 console.log('商贸公司信息修改');144 res.sendFile('/trade/info/update.json', getOptions());145});146//商贸公司状态修改;147router.post('/mock/trade/status/update', function (req, res) {148 console.log('商贸公司状态修改');149 res.sendFile('/trade/status/update.json', getOptions());150});151//商贸公司运费规则列表;152router.get('/mock/trade/fees/list', function (req, res) {153 console.log('商贸公司运费规则列表');154 res.sendFile('/trade/fees/list.json', getOptions());155});156/*157 * 店铺158 * */159//店铺类型获取;160router.get('/mock/shop/type/list', function (req, res) {161 console.log('店铺类型获取');162 res.sendFile('/shop/type/list.json', getOptions());163});164/*165 * 省、市、区县信息获取166 * */167//省、市、区县信息获取;168router.get('/mock/other/area/list', function (req, res) {169 console.log('省、市、区县信息获取');170 res.sendFile('/other/area/list.json', getOptions());171});172//地区列表获取;173router.get('/mock/other/custom-area/list', function (req, res) {174 console.log('地区列表获取');175 res.sendFile('/other/custom-area/list.json', getOptions());176});177//可推送用户列表;178router.get('/mock/operate/daily-news/receive-user/list', function (req, res) {179 console.log('可推送用户列表');180 res.sendFile('/operate/daily-news/receive-user/list.json', getOptions());181});182//今日推文列表;183router.get('/mock/operate/today-article/list', function (req, res) {184 console.log('今日推文列表');185 res.sendFile('/operate/today-article/list.json', getOptions());186});187//今日推文列表;188router.get('/mock/other/today-article/type', function (req, res) {189 console.log('今日推文列表');190 res.sendFile('/other/today-article/type.json', getOptions());191});192//今日推文编辑(添加/修改);193router.post('/mock/operate/today-article/edit', function (req, res) {194 console.log('今日推文编辑(添加/修改)');195 res.sendFile('/operate/today-article/edit.json', getOptions());196});197//今日推文删除;198router.post('/mock/operate/today-article/delete', function (req, res) {199 console.log('今日推文删除');200 res.sendFile('/operate/today-article/del.json', getOptions());201});202//推文商品列表;203router.get('/mock/operate/daily-news/goods/list', function (req, res) {204 console.log('推文商品列表');205 res.sendFile('/operate/daily-news/goods/list.json', getOptions());206});207//推文商品屏蔽操作;208router.post('/mock/operate/daily-news/goods/shield', function (req, res) {209 console.log('推文商品屏蔽操作');210 res.sendFile('/operate/daily-news/goods/shield.json', getOptions());211});212//前端上传数据到OSS的签名接口;213router.get('/mock/other/oss/signature', function (req, res) {214 console.log('前端上传数据到OSS的签名接口');215 res.sendFile('/other/oss/signature.json', getOptions());216});217//获取前端上传数据到OSS的请求ID;218router.get('/mock/other/oss/identity/data', function (req, res) {219 console.log('获取前端上传数据到OSS的请求ID');220 res.sendFile('/other/oss/identity/data.json', getOptions());221});222//推文日志列表;223router.get('/mock/operate/daily-news/log/list', function (req, res) {224 console.log('获取前端上传数据到OSS的请求ID');225 res.sendFile('/operate/daily-news/log/list.json', getOptions());226});227//每日推文设置get;228router.get('/mock/operate/daily-news/manage/list', function (req, res) {229 console.log('每日推文设置get');230 res.sendFile('/operate/daily-news/manage/list.json', getOptions());231});232//每日推文设置post;233router.post('/mock/operate/daily-news/manage/edit', function (req, res) {234 console.log('每日推文设置post');235 res.sendFile('/operate/daily-news/manage/edit.json', getOptions());236});237//店铺类型获取238router.get('/mock/shop/type/info', function (req, res) {239 console.log('店铺类型获取');240 res.sendFile('/shop/type/info.json', getOptions());241});242//读取活动列表243router.get('/mock/activities/list', function (req, res) {244 console.log('读取活动列表');245 res.sendFile('/activities/list.json', getOptions());246});247//添加活动248router.post('/mock/activities/add', function (req, res) {249 console.log('添加活动');250 res.sendFile('/activities/add.json', getOptions());251});252//更新活动253router.post('/mock/activities/update', function (req, res) {254 console.log('更新活动');255 res.sendFile('/activities/update.json', getOptions());256});257//活动商品列表258router.get('/mock/activities/goods/list', function (req, res) {259 console.log('活动商品列表');260 res.sendFile('/activities/goods/list.json', getOptions());261});262//活动商品添加263router.post('/mock/activities/goods/add', function (req, res) {264 console.log('活动商品添加');265 res.sendFile('/activities/goods/add.json', getOptions());266});267//活动商品删除268router.post('/mock/activities/goods/del', function (req, res) {269 console.log('活动商品删除表');270 res.sendFile('/activities/goods/del.json', getOptions());271});272//活动商品清空273router.post('/mock/activities/goods/clear', function (req, res) {274 console.log('活动商品清空');275 res.sendFile('/activities/goods/clear.json', getOptions());276});277//活动商品排序278router.post('/mock/activities/goods/sort', function (req, res) {279 console.log('活动商品排序');280 res.sendFile('/activities/goods/sort.json', getOptions());281});282/*283 * 访问日志284 * */285//当前页面所有访问统计get286router.get('/mock/statistic/page/all', function (req, res) {287 console.log('当前页面所有访问统计get');288 res.sendFile('/statistic/page/list.json', getOptions());289});290//店铺访问统计数据展示get291router.get('/mock/statistic/page/detail', function (req, res) {292 console.log('店铺访问统计数据展示get');293 res.sendFile('/statistic/page/detail.json', getOptions());294});295//商品当前结果统计get296router.get('/mock/statistic/goods/all', function (req, res) {297 console.log('商品当前结果统计get');298 res.sendFile('/statistic/goods/list.json', getOptions());299});300//商品访问统计数据展示get301router.get('/mock/statistic/goods/detail', function (req, res) {302 console.log('商品访问统计数据展示get');303 res.sendFile('/statistic/goods/detail.json', getOptions());304});305//指定商品访问统计数据展示get306router.get('/mock/statistic/goods-specific/detail', function (req, res) {307 console.log('指定商品访问统计数据展示get');308 res.sendFile('/statistic/goods-specific/detail.json', getOptions());309});310/*311 * 店铺312 * */313//添加推荐榜商品;314router.post('/mock/operate/daily-news/goods/recommend', function (req, res) {315 console.log('添加推荐榜商品');316 res.sendFile('/operate/daily-news/goods/recommend.json', getOptions());317});318//移除单个推荐榜商品;319router.post('/mock/operate/daily-news/recommend/goods/remove', function (req, res) {320 console.log('移除单个推荐榜商品');321 res.sendFile('/operate/daily-news/recommend/goods/remove.json', getOptions());322});323//移除全部推荐榜商品;324router.post('/mock/operate/daily-news/recommend/goods/remove-all', function (req, res) {325 console.log('移除单个推荐榜商品');326 res.sendFile('/operate/daily-news/recommend/goods/remove-list.json', getOptions());327});328//推荐榜商品排序;329router.post('/mock/operate/daily-news/recommend/goods/sort', function (req, res) {330 console.log('推荐榜商品排序');331 res.sendFile('/operate/daily-news/recommend/goods/sort.json', getOptions());332});333/*334 * 商品分类管理;335 * */336//添加商品分类;337router.post('/mock/goods/type/add', function (req, res) {338 console.log('添加商品分类');339 res.sendFile('/goods/type/add.json', getOptions());340});341//获取商品分类数据;342router.get('/mock/goods/type/list', function (req, res) {343 console.log('获取商品分类数据');344 res.sendFile('/goods/type/list.json', getOptions());345});346//修改商品分类;347router.post('/mock/goods/type/update', function (req, res) {348 console.log('修改商品分类');349 res.sendFile('/goods/type/update.json', getOptions());350});351//删除商品分类;352router.post('/mock/goods/type/delete', function (req, res) {353 console.log('删除商品分类');354 res.sendFile('/goods/type/del.json', getOptions());355});356//删除商品分类;357router.post('/mock/goods/type/sort', function (req, res) {358 console.log('删除商品分类');359 res.sendFile('/goods/type/sort.json', getOptions());360});361//获取商品分类信息;362router.get('/mock/goods/type/info', function (req, res) {363 console.log('获取商品分类信息');364 res.sendFile('/goods/type/info.json', getOptions());365});366//商品属性可输入格式获取;367router.get('/mock/other/goods/type/attr/input-format/list', function (req, res) {368 console.log('商品属性可输入格式获取');369 res.sendFile('/other/goods/type/attr/input-format/list.json', getOptions());370});371//商品分类基本属性获取;372router.get('/mock/goods/type/basic-attr/get', function (req, res) {373 console.log('商品分类基本属性获取');374 res.sendFile('/goods/type/basic-attr/get.json', getOptions());375});376//商品分类基本属性添加或者更改;377router.post('/mock/goods/type/basic-attr/update', function (req, res) {378 console.log('商品分类基本属性添加或者更改');379 res.sendFile('/goods/type/basic-attr/update.json', getOptions());380});381//分类特殊属性添加/修改;382router.post('/mock/goods/type/special-attr/update', function (req, res) {383 console.log('分类特殊属性添加/修改');384 res.sendFile('/goods/type/special-attr/update.json', getOptions());385});386//分类特殊属性信息列表;387router.get('/mock/goods/type/special-attr/list', function (req, res) {388 console.log('分类特殊属性信息列表');389 res.sendFile('/goods/type/special-attr/list.json', getOptions());390});391//分类特殊属性删除;392router.post('/mock/goods/type/special-attr/delete', function (req, res) {393 console.log('分类特殊属性删除');394 res.sendFile('/goods/type/special-attr/del.json', getOptions());395});396/*397 * 品牌管理398 * */399//分页读取品牌列表400router.get('/mock/goods/brands/list', function (req, res) {401 console.log('分页读取品牌列表');402 res.sendFile('/goods/brands/list.json', getOptions());403});404//删除品牌405router.post('/mock/goods/brands/delete', function (req, res) {406 console.log('删除品牌');407 res.sendFile('/goods/brands/del.json', getOptions());408});409//新增品牌410router.post('/mock/goods/brands/add', function (req, res) {411 console.log('新增品牌');412 res.sendFile('/goods/brands/add.json', getOptions());413});414//更新品牌415router.post('/mock/goods/brands/update', function (req, res) {416 console.log('更新品牌');417 res.sendFile('/goods/brands/update.json', getOptions());418});419/*420 <<<<<<< HEAD421 * 商品转移422 * */423//店铺列表424router.get('/mock/goods/transfer/shop/list', function (req, res) {425 console.log('店铺列表');426 res.sendFile('/goods/transfer/shop/list.json', getOptions());427});428//商品列表429router.get('/mock/goods/transfer/list', function (req, res) {430 console.log('商品列表');431 res.sendFile('/goods/transfer/list.json', getOptions());432});433/*434 * 转移商品435 * */436//店铺列表(只列出有商品可转移的店铺);437router.get('/mock/goods/transfer/shop/list', function (req, res) {438 console.log('店铺列表(只列出有商品可转移的店铺)');439 res.sendFile('/goods/transfer/shop/list.json', getOptions());440});441//需转移商品列表;442router.get('/mock/goods/transfer/list', function (req, res) {443 console.log('需转移商品列表');444 res.sendFile('/goods/transfer/list.json', getOptions());445});446//供应商信息查询447router.get('/mock/goods/shop/info', function (req, res) {448 console.log('供应商信息查询');449 res.sendFile('/goods/shop/info.json', getOptions());450});451//屏蔽操作452router.post('/mock/goods/transfer/shielding', function (req, res) {453 console.log('屏蔽操作');454 res.sendFile('/goods/transfer/shielding.json', getOptions());455});456//删除操作457router.post('/mock/goods/transfer/old-goods/del', function (req, res) {458 console.log('删除操作');459 res.sendFile('/goods/transfer/old-goods/del.json', getOptions());460});461/*462 * 添加、修改、转移商品463 * */464//活动类型获取;465router.get('/mock/activities/type', function (req, res) {466 console.log('活动类型获取');467 res.sendFile('/activities/type.json', getOptions());468});469//商品单位获取;470router.get('/mock/other/goods/units', function (req, res) {471 console.log('商品单位获取');472 res.sendFile('/other/goods/units.json', getOptions());473});474//商品国别获取;475router.get('/mock/other/goods/smuggles', function (req, res) {476 console.log('商品国别获取');477 res.sendFile('/other/goods/smuggles.json', getOptions());478});479//商品图片删除;480router.post('/mock/goods/picture/del', function (req, res) {481 console.log('商品图片删除');482 res.sendFile('/goods/picture/del.json', getOptions());483});484//旧商品图片(包括检验报告)的获取;485router.get('/mock/goods/picture/list', function (req, res) {486 console.log('旧商品图片(包括检验报告)的获取');487 res.sendFile('/goods/picture/list.json', getOptions());488});489//检验报告图片删除;490router.post('/mock/goods/inspection-report/picture/del', function (req, res) {491 console.log('检验报告图片删除');492 res.sendFile('/goods/inspection-report/picture/del.json', getOptions());493});494//商品添加;495router.post('/mock/goods/add', function (req, res) {496 console.log('商品添加');497 res.sendFile('/goods/add.json', getOptions());498});499/*500 * 普通商品501 * */502//普通商品503router.get('/mock/goods/ordinary/list', function (req, res) {504 console.log('普通商品');505 res.sendFile('/goods/ordinary/list.json', getOptions());506});507//下架普通商品508router.post('/mock/goods/ordinary/sold-out', function (req, res) {509 console.log('下架普通商品');510 res.sendFile('/goods/ordinary/sold-out.json', getOptions());511});512//刷新普通商品价格513router.post('/mock/goods/ordinary/price-refresh', function (req, res) {514 console.log('刷新普通商品价格');515 res.sendFile('/goods/ordinary/price-refresh.json', getOptions());516});517//删除普通商品518router.post('/mock/goods/ordinary/delete', function (req, res) {519 console.log('删除普通商品');520 res.sendFile('/goods/ordinary/delete.json', getOptions());521});522//上架普通商品523router.post('/mock/goods/ordinary/on-sale', function (req, res) {524 console.log('上架普通商品');525 res.sendFile('/goods/ordinary/on-sale.json', getOptions());526});527//所在片区的发货市场获取528router.get('/mock/shop/custom-area/shipment-market/list', function (req, res) {529 console.log('所在片区的发货市场获取');530 res.sendFile('/shop/custom-area/shipment-market/list.json', getOptions());531});532//恢复删除普通商品533router.post('/mock/goods/ordinary/undelete', function (req, res) {534 console.log('恢复删除普通商品');535 res.sendFile('/goods/ordinary/undelete.json', getOptions());536});537/*538 * 待审核商品539 * */540//有待审核商品的市场及店铺列表;541router.get('/mock/shop/new-goods/market/list', function (req, res) {542 console.log('有待审核商品的市场及店铺列表');543 res.sendFile('/shop/new-goods/market/list.json', getOptions());544});545//待审核商品列表546router.get('/mock/goods/new-goods/list', function (req, res) {547 console.log('待审核商品列表');548 res.sendFile('/goods/new-goods/list.json', getOptions());549});550//审核通过(通过)551router.post('/mock/goods/audit/pass', function (req, res) {552 console.log('审核通过(通过)');553 res.sendFile('/goods/audit/pass.json', getOptions());554});555//审核拒绝556router.post('/mock/goods/audit/refused', function (req, res) {557 console.log('审核拒绝');558 res.sendFile('/goods/audit/refused.json', getOptions());559});560/*561 * 商品日志562 * */563//商品历史价格日志列表564router.get('/mock/goods/logs/list', function (req, res) {565 console.log('商品历史价格日志列表');566 res.sendFile('/goods/logs/list.json', getOptions());567});568//商品历史价格日志列表569router.get('/mock/goods/history-prices/list', function (req, res) {570 console.log('商品历史价格日志列表');571 res.sendFile('/goods/history-prices/list.json', getOptions());572});573//商品详细信息获取574router.get('/mock/goods/info', function (req, res) {575 console.log('商品详细信息获取');576 res.sendFile('/goods/info.json', getOptions());577});578//商品修改579router.get('/mock/goods/update', function (req, res) {580 console.log('商品修改');581 res.sendFile('/goods/update.json', getOptions());582});583//获取价格体系规则;584router.get('/mock/goods/price-rules', function (req, res) {585 console.log('商品修改');586 res.sendFile('/goods/price-rules.json', getOptions());587});588/**589 * 权重配置590 */591//获取权重的信息592router.get('/mock/search/boost', function (req, res) {593 console.log('获取权重配置');594 res.sendFile('/search/boost.json', getOptions());595});596//发送权重配置的信息597router.post('/mock/search/boost', function (req, res) {598 console.log('发送权重配置');599 res.sendFile('/search/search.json', getOptions());600});601/*602 * 商品词库管理;603 * */604//获取同义词的数据;605router.get('/mock/search/synonym', function (req, res) {606 res.sendFile('/search/synonym/synonym.txt', getOptions());607});608//获取自定义词库的数据;609router.get('/mock/search/custom', function (req, res) {610 res.sendFile('/search/custom/custom.txt', getOptions());611});612//更新搜索同义词;613router.post('/mock/search/synonym/update', function (req, res) {614 res.sendFile('/search/synonym/update.json', getOptions());615});616//更新搜索自定义词库;617router.post('/mock/search/custom/update', function (req, res) {618 res.sendFile('/search/custom/update.json', getOptions());619});620//更新索引;621router.post('/mock/search/index/init', function (req, res) {622 res.sendFile('/search/index/init.json', getOptions());623});624/**625 * 物流区域配置626 */627//不通过id获取当前所有的区域628router.get('/mock/logistics/area/map', function (req, res) {629 res.sendFile('/logistic/area/area.json', getOptions());630});631//通过id获取当前所有的区域632router.get('/mock/logistics/area/map/:id', function (req, res) {633 res.sendFile('/logistic/area/area.json', getOptions());634});635//通过id获取所有街道的信息636router.get('/mock/logistics/area/street/:id', function (req, res) {637 res.sendFile('/logistic/area/street.json', getOptions());638});639//修改区街道的状态640router.post('/mock/logistics/area/street/status', function (req, res) {641 res.sendFile('logistic/area/modify-state.json', getOptions());642});643/**644 * 运力管理645 */646// 获取所有的运力数据647router.get('/mock/logistics/capacity/:display', function (req, res) {648 res.sendFile('logistic/capacity/list.json', getOptions());649});650// 修改运力数据651router.post('/mock/logistics/capacity/update', function (req, res) {652 res.sendFile('logistic/capacity/modify.json', getOptions());653});654// 添加新运力655router.post('/mock/logistics/capacity/add', function (req, res) {656 res.sendFile('logistic/capacity/add.json', getOptions());657});658// 删除运力信息659router.post('/mock/logistics/capacity/delete', function (req, res) {660 res.sendFile('logistic/capacity/modify.json', getOptions());661});662/**663 * 司机信息664 */665// 获取所有的司机信息666router.get('/mock/logistics/driver', function (req, res) {667 res.sendFile('logistic/driver/list.json', getOptions());668});669// 修改司机状态信息670router.post('/mock/logistics/driver/status', function (req, res) {671 res.sendFile('logistic/driver/change.json', getOptions());672});673// 修改司机信息674router.post('/mock/logistics/driver/update', function (req, res) {675 res.sendFile('logistic/driver/modify.json', getOptions());676});677// 删除司机信息678router.post('/mock/logistics/driver/delete', function (req, res) {679 res.sendFile('logistic/driver/modify.json', getOptions());680});681// 获取当值司机的列表信息682router.get('/mock/logistics/capacitys/available', function (req, res) {683 res.sendFile('logistic/driver/work.json', getOptions());684});685/**686 * 运单管理687 */688// 获取全部的运单信息689router.post('/mock/logistics/delivery', function (req, res) {690 res.sendFile('logistic/bill/list.json', getOptions());691});692// 管理员作废运单693router.post('/mock/logistics/delivery/cancel/:id', function (req, res) {694 res.sendFile('logistic/bill/cancel.json', getOptions());695});696// 获得当前选中的运单详情697router.get('/mock/logistics/deliverys/:id', function (req, res) {698 res.sendFile('logistic/bill/current.json', getOptions());699});700// 更新运单详情701router.post('/mock/logistics/delivery/update/:method/:id', function (req, res) {702 res.sendFile('logistic/bill/cancel.json', getOptions());703});704// 收揽运单705router.post('/mock/logistics/delivery/received/:id', function (req, res) {706 res.sendFile('logistic/bill/cancel.json', getOptions());707});708/**709 * 实时运单状态710 */711// 实时运单状态列表712router.get('/mock/logistics/intime', function (req, res) {713 res.sendFile('logistic/bill/intimeList.json', getOptions());714});715router.get('/mock/logistics/intime/:id', function (req, res) {716 res.sendFile('logistic/bill/intimeDetail.json', getOptions());717});718/**719 * 调度分配720 */721// 获取当日的运单统计数据722router.get('/mock/logistics/delivery/statics', function (req, res) {723 res.sendFile('logistic/bill/statics.json', getOptions());724});725// 获取当日的运单列表坐标集合726router.get('/mock/logistics/delivery/points', function (req, res) {727 res.sendFile('logistic/bill/points.json', getOptions());728});729// 分配运单730router.post('/mock/logistics/delivery/assign', function (req, res) {731 res.sendFile('logistic/bill/assign.json', getOptions());732});733/**734 * 录单735 */736// 搜索商家737router.get('/mock/logistics/shop/search', function (req, res) {738 res.sendFile('logistic/add/shop-search.json', getOptions());739});740// 添加商家741router.post('/mock/logistics/shop/sign', function (req, res) {742 res.sendFile('logistic/add/shop-add.json', getOptions());743});744// 生成地址745router.get('/mock/logistics/shop/address/:id', function (req, res) {746 res.sendFile('logistic/add/custom-address.json', getOptions());747});748// 保存收货人749router.post('/mock/logistics/shop/order/:id', function (req, res) {750 res.sendFile('logistic/add/custom.json', getOptions());751});752// 修改收货人地址753router.post('/mock/logistics/shop/address/update/:id', function (req, res) {754 res.sendFile('logistic/add/custom.json', getOptions());755});756// 新增收货人地址757router.post('/mock/logistics/shop/address/add/:id', function (req, res) {758 res.sendFile('logistic/add/custom.json', getOptions());759});760/**761 * 客户管理762 */763// 获取所有客户地址信息764router.get('/mock/logistics/custom', function (req, res) {765 res.sendFile('logistic/customer/list.json', getOptions());766});767// 获取单个的客户地址768router.get('/mock/logistics/custom/:id', function (req, res) {769 res.sendFile('logistic/customer/one.json', getOptions());770});771// 编辑用户地址772router.post('/mock/logistics/custom/:id', function (req, res) {773 res.sendFile('logistic/customer/update.json', getOptions());774});775/**776 * 运费管理777 */778// 获得未付款的运费779router.get('/mock/logistics/charge/unpaid', function (req, res) {780 res.sendFile('logistic/charge/unpay.json', getOptions());781});782// 获得已完成的运费783router.get('/mock/logistics/charge/paid', function (req, res) {784 res.sendFile('logistic/charge/paid.json', getOptions());785});786// 获得已撤销的运费787router.get('/mock/logistics/charge/canceled', function (req, res) {788 res.sendFile('logistic/charge/cancel.json', getOptions());789});790// 撤销运费791router.post('/mock/logistics/charge/cancel/:id', function (req, res) {792 res.sendFile('logistic/charge/status.json', getOptions());793});794// 确定实收费用795router.post('/mock/logistics/charge/create', function (req, res) {796 res.sendFile('logistic/charge/status.json', getOptions());797});798// 发送短信验证码799router.post('/mock/verify/mobile', function (req, res) {800 res.sendFile('logistic/charge/status.json', getOptions());801});802// 作废(免单)803router.post('/mock/logistics/charge/free', function (req, res) {804 res.sendFile('logistic/charge/status.json', getOptions());805});806/*807 * 运费配置;808 * */809//获取运费配置规则;810router.get('/mock/logistics/charge/getconfig', function (req, res) {811 res.sendFile('logistics/charge/getconfig.json', getOptions());812});813//设置运费配置规则;814router.post('/mock/logistics/charge/setconfig', function (req, res) {815 res.sendFile('logistics/charge/setconfig.json', getOptions());816});817/**818 * 地图通用819 */820// 地点搜索821router.post('/mock/map/search/hint', function (req, res) {822 res.sendFile('logistic/map/text.json', getOptions());823});824// 通过经纬度获取地理位置825router.post('/mock/map/geocode/regeo', function (req, res) {826 res.sendFile('logistic/full-address.json', getOptions());827});828/*829 * 服务商统计830 * */831//客户统计832router.post('/mock/bi/provider/customers', function (req, res) {833 res.sendFile('bi/provider/customers.json', getOptions());834});835//订单统计836router.post('/mock/bi/provider/order', function (req, res) {837 res.sendFile('bi/provider/order.json', getOptions());838});839//订单排行840router.post('/mock/bi/provider/rank-order', function (req, res) {841 console.log('订单排行');842 res.sendFile('bi/provider/rank-order.json', getOptions());843});844//商品排行845router.post('/mock/bi/provider/rank-goods', function (req, res) {846 console.log('商品排行');847 res.sendFile('bi/provider/rank-goods.json', getOptions());848});...

Full Screen

Full Screen

data-otherHall.js

Source:data-otherHall.js Github

copy

Full Screen

...10 this.el = o.el;11 this.parent = o.parent;12 },13 render: function () {14 this.$('#admissionNm').html(this.getOptions(ToolbarModel.getAdmissionNm()));15 this.$('#typeNm').html(this.getOptions(ToolbarModel.getTypeNm()));16 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate()));17 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime()));18 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm()));19 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm()));20 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm()));21 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm()));22 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm()));23 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm()));24 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm()));25 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm()));26 return this;27 },28 events: {29 'click #search': 'searchClicked',30 'change #admissionNm': 'admissionNmChanged',31 'change #typeNm': 'typeNmChanged',32 'change #attendDate': 'attendDateChanged',33 'change #attendTime': 'attendTimeChanged',34 'change #deptNm': 'deptNmChanged',35 'change #majorNm': 'majorNmChanged',36 'change #headNm': 'headNmChanged',37 'change #bldgNm': 'bldgNmChanged',38 'change #hallNm': 'hallNmChanged',39 'change #attendHeadNm': 'attendHeadNmChanged',40 'change #attendBldgNm': 'attendBldgNmChanged'41 },42 searchClicked: function (e) {43 e.preventDefault();44 var _this = this;45 if (this.parent) {46 this.parent.search({47 admissionNm: _this.$('#admissionNm').val(),48 typeNm: _this.$('#typeNm').val(),49 attendDate : _this.$('#attendDate').val(),50 attendTime : _this.$('#attendTime').val(),51 deptNm : _this.$('#deptNm').val(),52 majorNm : _this.$('#majorNm').val(),53 headNm: _this.$('#headNm').val(),54 bldgNm: _this.$('#bldgNm').val(),55 hallNm : _this.$('#hallNm').val(),56 attendHeadNm: _this.$('#attendHeadNm').val(),57 attendBldgNm: _this.$('#attendBldgNm').val(),58 attendHallNm : _this.$('#attendHallNm').val(),59 examineeCd : _this.$('#examineeCd').val(),60 examineeNm : _this.$('#examineeNm').val(),61 isEtc : _this.$('#isEtc').val()62 });63 }64 },65 admissionNmChanged: function (e){66 var param = {67 admissionNm: e.currentTarget.value68 };69 this.$('#typeNm').html(this.getOptions(ToolbarModel.getTypeNm(param)));70 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate(param)));71 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));72 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));73 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));74 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));75 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));76 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));77 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));78 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));79 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));80 },81 typeNmChanged: function (e){82 var param = {83 admissionNm: this.$('#admissionNm').val(),84 typeNm: e.currentTarget.value85 };86 this.$('#typeNm').html(this.getOptions(ToolbarModel.getTypeNm(param)));87 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate(param)));88 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));89 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));90 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));91 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));92 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));93 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));94 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));95 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));96 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));97 },98 attendDateChanged: function (e){99 var param = {100 admissionNm: this.$('#admissionNm').val(),101 typeNm: this.$('#typeNm').val(),102 attendDate: e.currentTarget.value103 };104 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));105 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));106 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));107 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));108 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));109 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));110 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));111 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));112 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));113 },114 attendTimeChanged: function (e){115 var param = {116 admissionNm: this.$('#admissionNm').val(),117 typeNm: this.$('#typeNm').val(),118 attendDate: this.$('#attendDate').val(),119 attendTime: e.currentTarget.value120 };121 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));122 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));123 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));124 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));125 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));126 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));127 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));128 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));129 },130 deptNmChanged: function (e){131 var param = {132 admissionNm: this.$('#admissionNm').val(),133 typeNm: this.$('#typeNm').val(),134 attendDate: this.$('#attendDate').val(),135 attendTime: this.$('#attendTime').val(),136 deptNm: e.currentTarget.value137 };138 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));139 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));140 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));141 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));142 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));143 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));144 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));145 },146 majorNmChanged: function (e){147 var param = {148 admissionNm: this.$('#admissionNm').val(),149 typeNm: this.$('#typeNm').val(),150 attendDate: this.$('#attendDate').val(),151 attendTime: this.$('#attendTime').val(),152 deptNm: this.$('#deptNm').val(),153 majorNm: e.currentTarget.value154 };155 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));156 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));157 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));158 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));159 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));160 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));161 },162 headNmChanged: function (e){163 var param = {164 admissionNm: this.$('#admissionNm').val(),165 typeNm: this.$('#typeNm').val(),166 attendDate: this.$('#attendDate').val(),167 attendTime: this.$('#attendTime').val(),168 deptNm: this.$('#deptNm').val(),169 majorNm: this.$('#majorNm').val(),170 headNm: e.currentTarget.value171 };172 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));173 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));174 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));175 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));176 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));177 },178 bldgNmChanged: function (e){179 var param = {180 admissionNm: this.$('#admissionNm').val(),181 typeNm: this.$('#typeNm').val(),182 attendDate: this.$('#attendDate').val(),183 attendTime: this.$('#attendTime').val(),184 deptNm: this.$('#deptNm').val(),185 majorNm: this.$('#majorNm').val(),186 headNm: this.$('#headNm').val(),187 bldgNm: e.currentTarget.value188 };189 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));190 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));191 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));192 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));193 },194 hallNmChanged: function (e){195 var param = {196 admissionNm: this.$('#admissionNm').val(),197 typeNm: this.$('#typeNm').val(),198 attendDate: this.$('#attendDate').val(),199 attendTime: this.$('#attendTime').val(),200 deptNm: this.$('#deptNm').val(),201 majorNm: this.$('#majorNm').val(),202 headNm: this.$('#headNm').val(),203 bldgNm: this.$('#bldgNm').val(),204 hallNm: e.currentTarget.value205 };206 this.$('#attendHeadNm').html(this.getOptions(ToolbarModel.getAttendHeadNm(param)));207 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));208 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));209 },210 attendHeadNmChanged: function (e){211 var param = {212 admissionNm: this.$('#admissionNm').val(),213 typeNm: this.$('#typeNm').val(),214 attendDate: this.$('#attendDate').val(),215 attendTime: this.$('#attendTime').val(),216 deptNm: this.$('#deptNm').val(),217 majorNm: this.$('#majorNm').val(),218 headNm: this.$('#headNm').val(),219 hall: this.$('#hallNm').val(),220 attendHeadNm: e.currentTarget.value221 };222 this.$('#attendBldgNm').html(this.getOptions(ToolbarModel.getAttendBldgNm(param)));223 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));224 },225 attendBldgNmChanged: function (e){226 var param = {227 admissionNm: this.$('#admissionNm').val(),228 typeNm: this.$('#typeNm').val(),229 attendDate: this.$('#attendDate').val(),230 attendTime: this.$('#attendTime').val(),231 deptNm: this.$('#deptNm').val(),232 majorNm: this.$('#majorNm').val(),233 headNm: this.$('#headNm').val(),234 hall: this.$('#hallNm').val(),235 attendHeadNm: this.$('#attendHeadNm').val(),236 attendBldgNm: e.currentTarget.value237 };238 this.$('#attendHallNm').html(this.getOptions(ToolbarModel.getAttendHallNm(param)));239 }240 });...

Full Screen

Full Screen

data-paper.js

Source:data-paper.js Github

copy

Full Screen

...10 this.el = o.el;11 this.parent = o.parent;12 },13 render: function () {14 this.$('#admissionNm').html(this.getOptions(ToolbarModel.getAdmissionNm()));15 this.$('#typeNm').html(this.getOptions(ToolbarModel.getTypeNm()));16 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate()));17 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime()));18 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm()));19 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm()));20 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm()));21 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm()));22 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm()));23 return this;24 },25 events: {26 'click #search': 'searchClicked',27 'change #admissionNm': 'admissionNmChanged',28 'change #typeNm': 'typeNmChanged',29 'change #attendDate': 'attendDateChanged',30 'change #attendTime': 'attendTimeChanged',31 'change #deptNm': 'deptNmChanged',32 'change #majorNm': 'majorNmChanged',33 'change #headNm': 'headNmChanged',34 'change #bldgNm': 'bldgNmChanged',35 'change #hallNm': 'hallNmChanged'36 },37 searchClicked: function (e) {38 e.preventDefault();39 var _this = this;40 if (this.parent) {41 this.parent.search({42 admissionNm: _this.$('#admissionNm').val(),43 typeNm : _this.$('#typeNm').val(),44 attendDate : _this.$('#attendDate').val(),45 attendTime : _this.$('#attendTime').val(),46 deptNm: _this.$('#deptNm').val(),47 majorNm: _this.$('#majorNm').val(),48 headNm: _this.$('#headNm').val(),49 bldgNm: _this.$('#bldgNm').val(),50 hallNm : _this.$('#hallNm').val(),51 paperCd : _this.$('#paperCd').val(),52 examineeCd : _this.$('#examineeCd').val(),53 examineeNm : _this.$('#examineeNm').val()54 });55 }56 },57 admissionNmChanged: function (e) {58 var param = {59 admissionNm: e.currentTarget.value60 };61 this.$('#typeNm').html(this.getOptions(ToolbarModel.getTypeNm(param)));62 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate(param)));63 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));64 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));65 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));66 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));67 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));68 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));69 },70 typeNmChanged: function (e) {71 var param = {72 admissionNm: this.$('#admissionNm').val(),73 typeNm: e.currentTarget.value74 };75 this.$('#attendDate').html(this.getOptions(ToolbarModel.getAttendDate(param)));76 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));77 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));78 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));79 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));80 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));81 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));82 },83 attendDateChanged: function (e) {84 var param = {85 admissionNm: this.$('#admissionNm').val(),86 typeNm: this.$('#typeNm').val(),87 attendDate: e.currentTarget.value88 };89 this.$('#attendTime').html(this.getOptions(ToolbarModel.getAttendTime(param)));90 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));91 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));92 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));93 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));94 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));95 },96 attendTimeChanged: function (e) {97 var param = {98 admissionNm: this.$('#admissionNm').val(),99 typeNm: this.$('#typeNm').val(),100 attendDate: this.$('#attendDate').val(),101 attendTime: e.currentTarget.value102 };103 this.$('#deptNm').html(this.getOptions(ToolbarModel.getDeptNm(param)));104 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));105 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));106 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));107 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));108 },109 deptNmChanged: function (e) {110 var param = {111 admissionNm: this.$('#admissionNm').val(),112 typeNm: this.$('#typeNm').val(),113 attendDate: this.$('#attendDate').val(),114 attendTime: this.$('#attendTime').val(),115 deptNm: e.currentTarget.value116 };117 this.$('#majorNm').html(this.getOptions(ToolbarModel.getMajorNm(param)));118 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));119 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));120 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));121 },122 majorNm: function (e) {123 var param = {124 admissionNm: this.$('#admissionNm').val(),125 typeNm: this.$('#typeNm').val(),126 attendDate: this.$('#attendDate').val(),127 attendTime: this.$('#attendTime').val(),128 deptNm: this.$('#deptNm').val(),129 majorNm: e.currentTarget.value130 };131 this.$('#headNm').html(this.getOptions(ToolbarModel.getHeadNm(param)));132 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));133 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));134 },135 headNmChanged: function (e) {136 var param = {137 admissionNm: this.$('#admissionNm').val(),138 typeNm: this.$('#typeNm').val(),139 attendDate: this.$('#attendDate').val(),140 attendTime: this.$('#attendTime').val(),141 deptNm: this.$('#deptNm').val(),142 majorNm: this.$('#majorNm').val(),143 headNm: e.currentTarget.value144 };145 this.$('#bldgNm').html(this.getOptions(ToolbarModel.getBldgNm(param)));146 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));147 },148 bldgNmChanged: function (e) {149 var param = {150 admissionNm: this.$('#admissionNm').val(),151 typeNm: this.$('#typeNm').val(),152 attendDate: this.$('#attendDate').val(),153 attendTime: this.$('#attendTime').val(),154 deptNm: this.$('#deptNm').val(),155 majorNm: this.$('#majorNm').val(),156 headNm: this.$('#headNm').val(),157 bldgNm: e.currentTarget.value158 };159 this.$('#hallNm').html(this.getOptions(ToolbarModel.getHallNm(param)));160 }161 });...

Full Screen

Full Screen

editor-controller.js

Source:editor-controller.js Github

copy

Full Screen

...47 }));48 }49 updateActiveState() {50 const isActive = !this.editor.hasMultipleCursors()51 && this.tableEditor.cursorIsInTable(this.getOptions());52 if (isActive) {53 this.editor.element.classList.add(ACTIVE_CLASS);54 }55 else {56 this.editor.element.classList.remove(ACTIVE_CLASS);57 this.tableEditor.resetSmartCursor();58 }59 }60 getOptions() {61 const configOpt = {62 scope: this.editor.scopeDescriptorForBufferPosition(this.editor.getCursorBufferPosition())63 };64 return options({65 leftMarginChars : new Set(atom.config.get(`${NAMESPACE}.leftMarginChars`, configOpt)),66 formatType : atom.config.get(`${NAMESPACE}.formatType`, configOpt),67 minDelimiterWidth: atom.config.get(`${NAMESPACE}.minDelimiterWidth`, configOpt),68 defaultAlignment : atom.config.get(`${NAMESPACE}.defaultAlignment`, configOpt),69 headerAlignment : atom.config.get(`${NAMESPACE}.headerAlignment`, configOpt),70 smartCursor : atom.config.get(`${NAMESPACE}.smartCursor`, configOpt),71 textWidthOptions : {72 normalize : atom.config.get(`${NAMESPACE}.normalize`, configOpt),73 wideChars : new Set(atom.config.get(`${NAMESPACE}.wideChars`, configOpt)),74 narrowChars : new Set(atom.config.get(`${NAMESPACE}.narrowChars`, configOpt)),75 ambiguousAsWide: atom.config.get(`${NAMESPACE}.ambiguousAsWide`, configOpt)76 }77 });78 }79 format() {80 this.tableEditor.format(this.getOptions());81 }82 formatAll() {83 this.tableEditor.formatAll(this.getOptions());84 }85 escape() {86 this.tableEditor.escape(this.getOptions());87 }88 alignLeft() {89 this.tableEditor.alignColumn(Alignment.LEFT, this.getOptions());90 }91 alignRight() {92 this.tableEditor.alignColumn(Alignment.RIGHT, this.getOptions());93 }94 alignCenter() {95 this.tableEditor.alignColumn(Alignment.CENTER, this.getOptions());96 }97 alignNone() {98 this.tableEditor.alignColumn(Alignment.NONE, this.getOptions());99 }100 selectCell() {101 this.tableEditor.selectCell(this.getOptions());102 }103 moveLeft() {104 this.tableEditor.moveFocus(0, -1, this.getOptions());105 }106 moveRight() {107 this.tableEditor.moveFocus(0, 1, this.getOptions());108 }109 moveUp() {110 this.tableEditor.moveFocus(-1, 0, this.getOptions());111 }112 moveDown() {113 this.tableEditor.moveFocus(1, 0, this.getOptions());114 }115 nextCell() {116 this.tableEditor.nextCell(this.getOptions());117 }118 previousCell() {119 this.tableEditor.previousCell(this.getOptions());120 }121 nextRow() {122 this.tableEditor.nextRow(this.getOptions());123 }124 insertRow() {125 this.tableEditor.insertRow(this.getOptions());126 }127 deleteRow() {128 this.tableEditor.deleteRow(this.getOptions());129 }130 moveRowUp() {131 this.tableEditor.moveRow(-1, this.getOptions());132 }133 moveRowDown() {134 this.tableEditor.moveRow(1, this.getOptions());135 }136 insertColumn() {137 this.tableEditor.insertColumn(this.getOptions());138 }139 deleteColumn() {140 this.tableEditor.deleteColumn(this.getOptions());141 }142 moveColumnLeft() {143 this.tableEditor.moveColumn(-1, this.getOptions());144 }145 moveColumnRight() {146 this.tableEditor.moveColumn(1, this.getOptions());147 }148 destroy() {149 this.subscriptions.dispose();150 this.editorIntf.destroy();151 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getOptions } from 'storybook-root-decorator';2export const decorators = getOptions().decorators;3export const parameters = getOptions().parameters;4export const globalTypes = getOptions().globalTypes;5export const globals = getOptions().globals;6export const argTypesEnhancers = getOptions().argTypesEnhancers;7export const loaders = getOptions().loaders;8export const viewMode = getOptions().viewMode;9export const docsMode = getOptions().docsMode;10export const storyStoreV7 = getOptions().storyStoreV7;11export const storyStoreV6 = getOptions().storyStoreV6;12export const storyStore = getOptions().storyStore;13export const refs = getOptions().refs;14export const forceRender = getOptions().forceRender;15export const showRoots = getOptions().showRoots;16export const selectedPanel = getOptions().selectedPanel;17export const selectedPanel2 = getOptions().selectedPanel2;18export const selectedPanel3 = getOptions().selectedPanel3;19export const selectedPanel4 = getOptions().selectedPanel4;20export const selectedPanel5 = getOptions().selectedPanel5;21export const selectedPanel6 = getOptions().selectedPanel6;22export const selectedPanel7 = getOptions().selectedPanel7;23export const selectedPanel8 = getOptions().selectedPanel8;24export const selectedPanel9 = getOptions().selectedPanel9;25export const selectedPanel10 = getOptions().selectedPanel10;26export const selectedPanel11 = getOptions().selectedPanel11;27export const selectedPanel12 = getOptions().selectedPanel12;28export const selectedPanel13 = getOptions().selectedPanel13;29export const selectedPanel14 = getOptions().selectedPanel14;30export const selectedPanel15 = getOptions().selectedPanel15;31export const selectedPanel16 = getOptions().selectedPanel16;32export const selectedPanel17 = getOptions().selectedPanel17;33export const selectedPanel18 = getOptions().selectedPanel18;34export const selectedPanel19 = getOptions().selectedPanel19;35export const selectedPanel20 = getOptions().selectedPanel20;36export const selectedPanel21 = getOptions().selectedPanel21;37export const selectedPanel22 = getOptions().selectedPanel22;38export const selectedPanel23 = getOptions().selectedPanel23;39export const selectedPanel24 = getOptions().selectedPanel24;40export const selectedPanel25 = getOptions().selectedPanel25;

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getOptions } from 'storybook-root-decorator';2import { addDecorator } from '@storybook/react';3import { withRootDecorator } from 'storybook-root-decorator';4addDecorator(withRootDecorator());5import { withRootDecorator } from 'storybook-root-decorator';6export const decorators = [withRootDecorator()];7import { addons } from '@storybook/addons';8import { withRootDecorator } from 'storybook-root-decorator';9addons.setConfig({10 sidebar: {11 },12 previewTabs: {13 'storybook/docs/panel': {14 },15 },16 toolbar: {17 title: {18 },19 zoom: {20 },21 eject: {22 },23 copy: {24 },25 fullscreen: {26 },27 addons: {28 },29 stories: {30 },31 },32 panel: {33 },34 sidebar: {35 },36 previewTabs: {37 'storybook/docs/panel': {38 },39 },40 toolbar: {41 title: {42 },43 zoom: {44 },45 eject: {46 },47 copy: {48 },

Full Screen

Using AI Code Generation

copy

Full Screen

1const options = getOptions();2const storybook = getStorybook();3storiesOf('Button', module)4 .add('with text', () => <Button>Hello Button</Button>)5 .add('with some emoji', () => (6 ));7configure(loadStories, module);8setAddon(infoAddon);9addDecorator(withInfo);10addParameters({11 options: {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { getOptions } = require('storybook-root');2const { srcDir, distDir } = getOptions();3const { getOptions } = require('storybook-root');4const { srcDir, distDir } = getOptions();5const { getOptions } = require('storybook-root');6const { srcDir, distDir } = getOptions();7const { getOptions } = require('storybook-root');8const { srcDir, distDir } = getOptions();9const { getOptions } = require('storybook-root');10const { srcDir, distDir } = getOptions();11const { getOptions } = require('storybook-root');12const { srcDir, distDir } = getOptions();13const { getOptions } = require('storybook-root');14const { srcDir, distDir } = getOptions();15const { getOptions } = require('storybook-root');16const { srcDir, distDir } = getOptions();17const { getOptions } = require('storybook-root');18const { srcDir, distDir } = getOptions();19const { getOptions } = require('storybook-root');20const { srcDir, distDir } = getOptions();21const { getOptions } = require('storybook-root');22const { srcDir, distDir } = getOptions();23const { getOptions } = require('storybook-root');24const { srcDir, distDir } = getOptions();25const { getOptions } = require('storybook-root');26const { srcDir, distDir } = getOptions();27const { getOptions } = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getOptions } from 'storybook-root';2const options = getOptions();3console.log(options);4export function getOptions() {5 return { foo: 'bar' };6}

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 storybook-root 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