How to use element.getAttribute method in Appium

Best JavaScript code snippet using appium

Text.js

Source:Text.js Github

copy

Full Screen

1describe('Ext.field.Text', function() {2 var field,3 create = function(config) {4 field = Ext.create('Ext.field.Text', config || {});5 },6 render = function() {7 field.renderTo(Ext.getBody());8 };9 afterEach(function() {10 if (field) {11 field.destroy();12 field = null;13 }14 });15 describe('deprecated configurations + methods', function() {16 });17 describe("events", function() {18 describe("change", function() {19 it("should fire when you change the value from null", function() {20 create();21 var fired = false;22 field.on('change', function() {23 fired = true;24 }, this);25 field.setValue('test');26 expect(fired).toBeTruthy();27 });28 it("should fire when you change the value", function() {29 create({30 value: 'test'31 });32 var fired = false;33 field.on('change', function() {34 fired = true;35 }, this);36 field.setValue('test2');37 expect(fired).toBeTruthy();38 });39 it("should not fire when you change the value", function() {40 create({41 value: 'test'42 });43 var fired = false;44 field.on('change', function() {45 fired = true;46 }, this);47 field.setValue('test');48 expect(fired).toBeFalsy();49 });50 });51 });52 describe("configurations", function() {53 describe("name", function() {54 var defaultConfig = {55 name: 'myname'56 };57 describe("configuration", function() {58 it("should add the name attribute to the inputEl", function() {59 create(defaultConfig);60 render();61 expect(field.getComponent().inputElement.getAttribute('name')).toEqual('myname');62 });63 });64 describe("method", function() {65 describe("setting", function() {66 describe("before render", function() {67 it("should add the name attribute to the inputEl", function() {68 create();69 field.setName('myname');70 render();71 expect(field.getComponent().inputElement.getAttribute('name')).toEqual('myname');72 });73 });74 describe("after render", function() {75 it("should add the name attribute to the inputEl", function() {76 create();77 render();78 field.setName('myname');79 expect(field.getComponent().inputElement.getAttribute('name')).toEqual('myname');80 });81 });82 });83 describe("removing", function() {84 describe("before render", function() {85 it("should remove the name attribute from the inputEl", function() {86 create(defaultConfig);87 field.setName(null);88 render();89 expect(field.getComponent().inputElement.getAttribute('name')).toBeNull();90 });91 });92 describe("after render", function() {93 it("should remove the name attribute from the inputEl", function() {94 create(defaultConfig);95 render();96 field.setName(null);97 expect(field.getComponent().inputElement.getAttribute('name')).toBeNull();98 });99 });100 });101 });102 });103 describe("tabIndex", function() {104 var defaultConfig = {105 tabIndex: 10106 };107 describe("configuration", function() {108 it("should add the tabindex attribute to the inputEl", function() {109 create(defaultConfig);110 render();111 expect(field.getComponent().inputElement.getAttribute('tabindex')).toEqual('10');112 });113 });114 describe("method", function() {115 describe("setting", function() {116 describe("before render", function() {117 it("should add the tabindex attribute to the inputEl", function() {118 create();119 field.setTabIndex(10);120 render();121 expect(field.getComponent().inputElement.getAttribute('tabindex')).toEqual('10');122 });123 });124 describe("after render", function() {125 it("should add the tabindex attribute to the inputEl", function() {126 create();127 render();128 field.setTabIndex(10);129 expect(field.getComponent().inputElement.getAttribute('tabindex')).toEqual('10');130 });131 });132 });133 describe("removing", function() {134 describe("before render", function() {135 it("should remove the tabindex attribute from the inputEl", function() {136 create(defaultConfig);137 field.setTabIndex(null);138 render();139 waits(10);140 runs(function() {141 expect(field.getComponent().inputElement.getAttribute('tabindex')).toBeNull();142 });143 });144 });145 describe("after render", function() {146 it("should remove the tabindex attribute from the inputEl", function() {147 create(defaultConfig);148 render();149 field.setTabIndex(null);150 expect(field.getComponent().inputElement.getAttribute('tabindex')).toBeNull();151 });152 });153 });154 });155 });156 describe("maxLength", function() {157 var defaultConfig = {158 maxLength: 10159 };160 describe("configuration", function() {161 it("should add the maxlength attribute to the inputEl", function() {162 create(defaultConfig);163 render();164 expect(field.getComponent().inputElement.getAttribute('maxlength')).toEqual('10');165 });166 });167 describe("method", function() {168 describe("setting", function() {169 describe("before render", function() {170 it("should add the maxlength attribute to the inputEl", function() {171 create();172 field.setMaxLength(10);173 render();174 expect(field.getComponent().inputElement.getAttribute('maxlength')).toEqual('10');175 });176 });177 describe("after render", function() {178 it("should add the maxlength attribute to the inputEl", function() {179 create();180 render();181 field.setMaxLength(10);182 expect(field.getComponent().inputElement.getAttribute('maxlength')).toEqual('10');183 });184 });185 });186 describe("removing", function() {187 describe("before render", function() {188 it("should remove the maxlength attribute from the inputEl", function() {189 create(defaultConfig);190 field.setMaxLength(null);191 render();192 expect(field.getComponent().inputElement.getAttribute('maxlength')).toBeNull();193 });194 });195 describe("after render", function() {196 it("should remove the maxlength attribute from the inputEl", function() {197 create(defaultConfig);198 render();199 field.setMaxLength(null);200 expect(field.getComponent().inputElement.getAttribute('maxlength')).toBeNull();201 });202 });203 });204 });205 });206 describe("placeHolder", function() {207 var defaultConfig = {208 placeHolder: 'testing'209 };210 describe("configuration", function() {211 it("should add the placeholder attribute to the inputEl", function() {212 create(defaultConfig);213 render();214 expect(field.getComponent().inputElement.getAttribute('placeholder')).toEqual('testing');215 });216 });217 describe("method", function() {218 describe("setting", function() {219 describe("before render", function() {220 it("should add the placeholder attribute to the inputEl", function() {221 create();222 field.setPlaceHolder('testing');223 render();224 expect(field.getComponent().inputElement.getAttribute('placeholder')).toEqual('testing');225 });226 });227 describe("after render", function() {228 it("should add the placeholder attribute to the inputEl", function() {229 create();230 render();231 field.setPlaceHolder('testing');232 expect(field.getComponent().inputElement.getAttribute('placeholder')).toEqual('testing');233 });234 });235 });236 describe("removing", function() {237 describe("before render", function() {238 it("should remove the placeholder attribute from the inputEl", function() {239 create(defaultConfig);240 field.setPlaceHolder(null);241 render();242 expect(field.getComponent().inputElement.getAttribute('placeholder')).toBeNull();243 });244 });245 describe("after render", function() {246 it("should remove the placeholder attribute from the inputEl", function() {247 create(defaultConfig);248 render();249 field.setPlaceHolder(null);250 expect(field.getComponent().inputElement.getAttribute('placeholder')).toBeNull();251 });252 });253 });254 });255 });256 describe("autoComplete", function() {257 describe("using value 'on'", function() {258 var defaultConfig = {259 autoComplete: 'on'260 };261 describe("configuration", function() {262 it("should add the autocomplete attribute to the inputEl", function() {263 create(defaultConfig);264 render();265 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');266 });267 });268 describe("method", function() {269 describe("setting", function() {270 describe("before render", function() {271 it("should add the autocomplete attribute to the inputEl", function() {272 create();273 field.setAutoComplete('on');274 render();275 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');276 });277 });278 describe("after render", function() {279 it("should add the autocomplete attribute to the inputEl", function() {280 create();281 render();282 field.setAutoComplete('on');283 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');284 });285 });286 });287 describe("removing", function() {288 describe("before render", function() {289 it("should remove the autocomplete attribute from the inputEl", function() {290 create(defaultConfig);291 field.setAutoComplete(null);292 render();293 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');294 });295 });296 describe("after render", function() {297 it("should remove the autocomplete attribute from the inputEl", function() {298 create(defaultConfig);299 render();300 field.setAutoComplete(null);301 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');302 });303 });304 });305 });306 });307 describe("using value true", function() {308 var defaultConfig = {309 autoComplete: true310 };311 describe("configuration", function() {312 it("should add the autocomplete attribute to the inputEl", function() {313 create(defaultConfig);314 render();315 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');316 });317 });318 describe("method", function() {319 describe("setting", function() {320 describe("before render", function() {321 it("should add the autocomplete attribute to the inputEl", function() {322 create();323 field.setAutoComplete(true);324 render();325 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');326 });327 });328 describe("after render", function() {329 it("should add the autocomplete attribute to the inputEl", function() {330 create();331 render();332 field.setAutoComplete(true);333 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('on');334 });335 });336 });337 describe("removing", function() {338 describe("before render", function() {339 it("should remove the autocomplete attribute from the inputEl", function() {340 create(defaultConfig);341 field.setAutoComplete(null);342 render();343 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');344 });345 });346 describe("after render", function() {347 it("should remove the autocomplete attribute from the inputEl", function() {348 create(defaultConfig);349 render();350 field.setAutoComplete(null);351 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');352 });353 });354 });355 });356 });357 describe("using value 'off'", function() {358 var defaultConfig = {359 autoComplete: 'off'360 };361 describe("configuration", function() {362 it("should add the autocomplete attribute to the inputEl", function() {363 create(defaultConfig);364 render();365 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');366 });367 });368 describe("method", function() {369 describe("setting", function() {370 describe("before render", function() {371 it("should add the autocomplete attribute to the inputEl", function() {372 create();373 field.setAutoComplete('off');374 render();375 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');376 });377 });378 describe("after render", function() {379 it("should add the autocomplete attribute to the inputEl", function() {380 create();381 render();382 field.setAutoComplete('off');383 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');384 });385 });386 });387 describe("removing", function() {388 describe("before render", function() {389 it("should remove the autocomplete attribute from the inputEl", function() {390 create(defaultConfig);391 field.setAutoComplete(null);392 render();393 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');394 });395 });396 describe("after render", function() {397 it("should remove the autocomplete attribute from the inputEl", function() {398 create(defaultConfig);399 render();400 field.setAutoComplete(null);401 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');402 });403 });404 });405 });406 });407 describe("using value false", function() {408 var defaultConfig = {409 autoComplete: false410 };411 describe("configuration", function() {412 it("should add the autocomplete attribute to the inputEl", function() {413 create(defaultConfig);414 render();415 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');416 });417 });418 describe("method", function() {419 describe("setting", function() {420 describe("before render", function() {421 it("should add the autocomplete attribute to the inputEl", function() {422 create();423 field.setAutoComplete(false);424 render();425 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');426 });427 });428 describe("after render", function() {429 it("should add the autocomplete attribute to the inputEl", function() {430 create();431 render();432 field.setAutoComplete(false);433 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toEqual('off');434 });435 });436 });437 describe("removing", function() {438 describe("before render", function() {439 it("should remove the autocomplete attribute from the inputEl", function() {440 create(defaultConfig);441 field.setAutoComplete(null);442 render();443 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');444 });445 });446 describe("after render", function() {447 it("should remove the autocomplete attribute from the inputEl", function() {448 create(defaultConfig);449 render();450 field.setAutoComplete(null);451 expect(field.getComponent().inputElement.getAttribute('autocomplete')).toBe('off');452 });453 });454 });455 });456 });457 });458 describe("autoCapitalize", function() {459 describe("using value 'on'", function() {460 var defaultConfig = {461 autoCapitalize: 'on'462 };463 describe("configuration", function() {464 it("should add the autocapitalize attribute to the inputEl", function() {465 create(defaultConfig);466 render();467 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');468 });469 });470 describe("method", function() {471 describe("setting", function() {472 describe("before render", function() {473 it("should add the autocapitalize attribute to the inputEl", function() {474 create();475 field.setAutoCapitalize('on');476 render();477 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');478 });479 });480 describe("after render", function() {481 it("should add the autocapitalize attribute to the inputEl", function() {482 create();483 render();484 field.setAutoCapitalize('on');485 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');486 });487 });488 });489 describe("removing", function() {490 describe("before render", function() {491 it("should remove the autocapitalize attribute from the inputEl", function() {492 create(defaultConfig);493 field.setAutoCapitalize(null);494 render();495 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');496 });497 });498 describe("after render", function() {499 it("should remove the autocapitalize attribute from the inputEl", function() {500 create(defaultConfig);501 render();502 field.setAutoCapitalize(null);503 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');504 });505 });506 });507 });508 });509 describe("using value true", function() {510 var defaultConfig = {511 autoCapitalize: true512 };513 describe("configuration", function() {514 it("should add the autocapitalize attribute to the inputEl", function() {515 create(defaultConfig);516 render();517 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');518 });519 });520 describe("method", function() {521 describe("setting", function() {522 describe("before render", function() {523 it("should add the autocapitalize attribute to the inputEl", function() {524 create();525 field.setAutoCapitalize(true);526 render();527 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');528 });529 });530 describe("after render", function() {531 it("should add the autocapitalize attribute to the inputEl", function() {532 create();533 render();534 field.setAutoCapitalize(true);535 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('on');536 });537 });538 });539 describe("removing", function() {540 describe("before render", function() {541 it("should remove the autocapitalize attribute from the inputEl", function() {542 create(defaultConfig);543 field.setAutoCapitalize(null);544 render();545 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');546 });547 });548 describe("after render", function() {549 it("should remove the autocapitalize attribute from the inputEl", function() {550 create(defaultConfig);551 render();552 field.setAutoCapitalize(null);553 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');554 });555 });556 });557 });558 });559 describe("using value 'off'", function() {560 var defaultConfig = {561 autoCapitalize: 'off'562 };563 describe("configuration", function() {564 it("should add the autocapitalize attribute to the inputEl", function() {565 create(defaultConfig);566 render();567 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');568 });569 });570 describe("method", function() {571 describe("setting", function() {572 describe("before render", function() {573 it("should add the autocapitalize attribute to the inputEl", function() {574 create();575 field.setAutoCapitalize('off');576 render();577 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');578 });579 });580 describe("after render", function() {581 it("should add the autocapitalize attribute to the inputEl", function() {582 create();583 render();584 field.setAutoCapitalize('off');585 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');586 });587 });588 });589 describe("removing", function() {590 describe("before render", function() {591 it("should remove the autocapitalize attribute from the inputEl", function() {592 create(defaultConfig);593 field.setAutoCapitalize(null);594 render();595 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');596 });597 });598 describe("after render", function() {599 it("should remove the autocapitalize attribute from the inputEl", function() {600 create(defaultConfig);601 render();602 field.setAutoCapitalize(null);603 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');604 });605 });606 });607 });608 });609 describe("using value false", function() {610 var defaultConfig = {611 autoCapitalize: false612 };613 describe("configuration", function() {614 it("should add the autocapitalize attribute to the inputEl", function() {615 create(defaultConfig);616 render();617 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');618 });619 });620 describe("method", function() {621 describe("setting", function() {622 describe("before render", function() {623 it("should add the autocapitalize attribute to the inputEl", function() {624 create();625 field.setAutoCapitalize(false);626 render();627 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');628 });629 });630 describe("after render", function() {631 it("should add the autocapitalize attribute to the inputEl", function() {632 create();633 render();634 field.setAutoCapitalize(false);635 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toEqual('off');636 });637 });638 });639 describe("removing", function() {640 describe("before render", function() {641 it("should remove the autocapitalize attribute from the inputEl", function() {642 create(defaultConfig);643 field.setAutoCapitalize(null);644 render();645 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');646 });647 });648 describe("after render", function() {649 it("should remove the autocapitalize attribute from the inputEl", function() {650 create(defaultConfig);651 render();652 field.setAutoCapitalize(null);653 expect(field.getComponent().inputElement.getAttribute('autocapitalize')).toBe('off');654 });655 });656 });657 });658 });659 });660 describe("autoCorrect", function() {661 describe("using value 'on'", function() {662 var defaultConfig = {663 autoCorrect: 'on'664 };665 describe("configuration", function() {666 it("should add the autocorrect attribute to the inputEl", function() {667 create(defaultConfig);668 render();669 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');670 });671 });672 describe("method", function() {673 describe("setting", function() {674 describe("before render", function() {675 it("should add the autocorrect attribute to the inputEl", function() {676 create();677 field.setAutoCorrect('on');678 render();679 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');680 });681 });682 describe("after render", function() {683 it("should add the autocorrect attribute to the inputEl", function() {684 create();685 render();686 field.setAutoCorrect('on');687 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');688 });689 });690 });691 describe("removing", function() {692 describe("before render", function() {693 it("should remove the autocorrect attribute from the inputEl", function() {694 create(defaultConfig);695 field.setAutoCorrect(null);696 render();697 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');698 });699 });700 describe("after render", function() {701 it("should remove the autocorrect attribute from the inputEl", function() {702 create(defaultConfig);703 render();704 field.setAutoCorrect(null);705 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');706 });707 });708 });709 });710 });711 describe("using value true", function() {712 var defaultConfig = {713 autoCorrect: true714 };715 describe("configuration", function() {716 it("should add the autocorrect attribute to the inputEl", function() {717 create(defaultConfig);718 render();719 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');720 });721 });722 describe("method", function() {723 describe("setting", function() {724 describe("before render", function() {725 it("should add the autocorrect attribute to the inputEl", function() {726 create();727 field.setAutoCorrect(true);728 render();729 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');730 });731 });732 describe("after render", function() {733 it("should add the autocorrect attribute to the inputEl", function() {734 create();735 render();736 field.setAutoCorrect(true);737 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('on');738 });739 });740 });741 describe("removing", function() {742 describe("before render", function() {743 it("should remove the autocorrect attribute from the inputEl", function() {744 create(defaultConfig);745 field.setAutoCorrect(null);746 render();747 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');748 });749 });750 describe("after render", function() {751 it("should remove the autocorrect attribute from the inputEl", function() {752 create(defaultConfig);753 render();754 field.setAutoCorrect(null);755 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');756 });757 });758 });759 });760 });761 describe("using value 'off'", function() {762 var defaultConfig = {763 autoCorrect: 'off'764 };765 describe("configuration", function() {766 it("should add the autocorrect attribute to the inputEl", function() {767 create(defaultConfig);768 render();769 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');770 });771 });772 describe("method", function() {773 describe("setting", function() {774 describe("before render", function() {775 it("should add the autocorrect attribute to the inputEl", function() {776 create();777 field.setAutoCorrect('off');778 render();779 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');780 });781 });782 describe("after render", function() {783 it("should add the autocorrect attribute to the inputEl", function() {784 create();785 render();786 field.setAutoCorrect('off');787 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');788 });789 });790 });791 describe("removing", function() {792 describe("before render", function() {793 it("should remove the autocorrect attribute from the inputEl", function() {794 create(defaultConfig);795 field.setAutoCorrect(null);796 render();797 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');798 });799 });800 describe("after render", function() {801 it("should remove the autocorrect attribute from the inputEl", function() {802 create(defaultConfig);803 render();804 field.setAutoCorrect(null);805 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');806 });807 });808 });809 });810 });811 describe("using value false", function() {812 var defaultConfig = {813 autoCorrect: false814 };815 describe("configuration", function() {816 it("should add the autocorrect attribute to the inputEl", function() {817 create(defaultConfig);818 render();819 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');820 });821 });822 describe("method", function() {823 describe("setting", function() {824 describe("before render", function() {825 it("should add the autocorrect attribute to the inputEl", function() {826 create();827 field.setAutoCorrect(false);828 render();829 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');830 });831 });832 describe("after render", function() {833 it("should add the autocorrect attribute to the inputEl", function() {834 create();835 render();836 field.setAutoCorrect(false);837 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toEqual('off');838 });839 });840 });841 describe("removing", function() {842 describe("before render", function() {843 it("should remove the autocorrect attribute from the inputEl", function() {844 create(defaultConfig);845 field.setAutoCorrect(null);846 render();847 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');848 });849 });850 describe("after render", function() {851 it("should remove the autocorrect attribute from the inputEl", function() {852 create(defaultConfig);853 render();854 field.setAutoCorrect(null);855 expect(field.getComponent().inputElement.getAttribute('autocorrect')).toBe('off');856 });857 });858 });859 });860 });861 });862 });863 describe("methods", function() {864 describe("reset", function() {865 beforeEach(function () {866 create({867 value: 'foo'868 });869 render();870 field.setValue('foobar');871 });872 it("should update the input field element", function () {873 field.reset();874 expect(field.getComponent().input.dom.value).toBe('foo');875 });876 it("should synchronize the value of the component with the field", function () {877 field.reset();878 expect(field.getValue()).toBe('foo');879 expect(field.getComponent().getValue()).toBe('foo');880 });881 });882 });...

Full Screen

Full Screen

GmlRectifiedGrid.js

Source:GmlRectifiedGrid.js Github

copy

Full Screen

...62 }63 };64 // Internal. Intentionally not documented.65 GmlRectifiedGrid.prototype.captureAttributes = function (element) {66 this.id = element.getAttribute("gml:id");67 this.srsName = element.getAttribute("srsName");68 this.srsDimension = element.getAttribute("srsDimension");69 this.axisLabels = element.getAttribute("axisLabels");70 if (this.axisLabels) {71 this.axisLabels = this.axisLabels.split(/\s+/);72 }73 this.uomLabels = element.getAttribute("uomLabels");74 if (this.uomLabels) {75 this.uomLabels = this.uomLabels.split(/\s+/);76 }77 this.dimension = parseInt(element.getAttribute("dimension"));78 };79 // Internal. Intentionally not documented.80 GmlRectifiedGrid.prototype.assembleLimits = function (element) {81 var children = element.children || element.childNodes;82 for (var c = 0; c < children.length; c++) {83 var child = children[c];84 if (child.localName === "GridEnvelope") {85 return this.assembleGridEnvelope(child);86 }87 }88 };89 // Internal. Intentionally not documented.90 GmlRectifiedGrid.prototype.assembleGridEnvelope = function (element) {91 var children = element.children || element.childNodes, envelop = {};92 for (var c = 0; c < children.length; c++) {93 var child = children[c];94 envelop[child.localName] = child.textContent.split(/\s+/);95 }96 return envelop;97 };98 // Internal. Intentionally not documented.99 GmlRectifiedGrid.prototype.assembleOrigin = function (element) {100 var origin = {};101 origin.type = element.getAttribute("xlink:type");102 origin.href = element.getAttribute("xlink:href");103 origin.role = element.getAttribute("xlink:role");104 origin.arcrole = element.getAttribute("xlink:arcrole");105 origin.title = element.getAttribute("xlink:title");106 origin.show = element.getAttribute("xlink:show");107 origin.actuate = element.getAttribute("xlink:actuate");108 origin.nilReason = element.getAttribute("nilReason");109 origin.remoteSchema = element.getAttribute("gml:remoteSchema");110 origin.owns = element.getAttribute("owns");111 var children = element.children || element.childNodes;112 for (var c = 0; c < children.length; c++) {113 var child = children[c];114 if (child.localName === "Point") {115 origin.point = this.assemblePoint(child);116 } else if (child.localName === "pos") {117 origin.pos = this.assemblePos(child);118 }119 }120 return origin;121 };122 // Internal. Intentionally not documented.123 GmlRectifiedGrid.prototype.assemblePoint = function (element) {124 var point = {}, pos = {};125 point.id = element.getAttribute("gml:id");126 point.srsName = element.getAttribute("srsName");127 point.srsDimension = element.getAttribute("srsDimension");128 point.axisLabels = element.getAttribute("axisLabels");129 if (point.axisLabels) {130 point.axisLabels = point.axisLabels.split(/\s+/);131 }132 point.uomLabels = element.getAttribute("uomLabels");133 if (point.uomLabels) {134 point.uomLabels = point.uomLabels.split(/\s+/);135 }136 var children = element.children || element.childNodes;137 for (var c = 0; c < children.length; c++) {138 var child = children[c];139 if (child.localName === "description") {140 point.description = child.textContent;141 } else if (child.localName === "descriptionReference") {142 point.descriptionReference = this.assembleOrigin(child);143 } else if (child.localName === "identifier") {144 point.identifier = child.textContent;145 } else if (child.localName === "name") {146 point.name = child.textContent;147 } else if (child.localName === "pos") {148 point.pos = this.assemblePos(child);149 }150 }151 return point;152 };153 // Internal. Intentionally not documented.154 GmlRectifiedGrid.prototype.assemblePos = function (child) {155 var pos = {};156 pos.srsName = child.getAttribute("srsName");157 pos.srsDimension = parseInt(child.getAttribute("srsDimension"));158 pos.axisLabels = child.getAttribute("axisLabels");159 if (pos.axisLabels) {160 pos.axisLabels = pos.axisLabels.split(/\s+/);161 }162 pos.uomLabels = child.getAttribute("uomLabels");163 if (pos.uomLabels) {164 pos.uomLabels = pos.uomLabels.split(/\s+/);165 }166 pos.pos = child.textContent;167 if (pos.pos) {168 pos.pos = pos.pos.split(/\s+/);169 for (var p = 0; p < pos.pos.length; p++) {170 pos.pos[p] = parseFloat(pos.pos[p]);171 }172 }173 return pos;174 };175 // Internal. Intentionally not documented.176 GmlRectifiedGrid.prototype.assembleOffsetVector = function (element) {177 var children = element.children || element.childNodes, offsetVector = {}, rawValues;178 // Collect and store associated attributes179 offsetVector.srsName = element.getAttribute("srsName");180 offsetVector.srsDimension = parseInt(element.getAttribute("srsDimension"));181 offsetVector.axisLabels = element.getAttribute("axisLabels");182 if (offsetVector.axisLabels) {183 offsetVector.axisLabels = offsetVector.axisLabels.split(/\s+/);184 }185 offsetVector.uomLabels = element.getAttribute("uomLabels");186 if (offsetVector.uomLabels) {187 offsetVector.uomLabels = offsetVector.uomLabels.split(/\s+/);188 }189 rawValues = element.textContent.split(/\s+/);190 offsetVector.values = [];191 for (var i = 0; i < rawValues.length; i++) {192 offsetVector.values.push(parseFloat(rawValues[i]));193 }194 return offsetVector;195 };196 return GmlRectifiedGrid;...

Full Screen

Full Screen

Number.js

Source:Number.js Github

copy

Full Screen

1describe('Ext.field.Number', function() {2 var field,3 create = function(config) {4 field = Ext.create('Ext.field.Number', config || {});5 },6 render = function() {7 field.renderTo(Ext.getBody());8 };9 beforeEach(function() {10 });11 afterEach(function() {12 if (field) {13 field.destroy();14 }15 });16 describe('deprecated configurations + methods', function() {17 });18 describe("configurations", function() {19 describe("minValue", function() {20 var defaultConfig = {21 minValue: 1022 };23 describe("configuration", function() {24 it("should add the min attribute to the inputEl", function() {25 create(defaultConfig);26 render();27 expect(field.getComponent().inputElement.getAttribute('min')).toEqual('10');28 });29 });30 describe("method", function() {31 describe("setting", function() {32 describe("before render", function() {33 it("should add the min attribute to the inputEl", function() {34 create();35 field.setMinValue(10);36 render();37 expect(field.getComponent().inputElement.getAttribute('min')).toEqual('10');38 });39 });40 describe("after render", function() {41 it("should add the min attribute to the inputEl", function() {42 create();43 render();44 field.setMinValue(10);45 expect(field.getComponent().inputElement.getAttribute('min')).toEqual('10');46 });47 });48 });49 describe("removing", function() {50 describe("before render", function() {51 it("should remove the min attribute from the inputEl", function() {52 create(defaultConfig);53 field.setMinValue(null);54 render();55 expect(field.getComponent().inputElement.getAttribute('min')).toBeNull();56 });57 });58 describe("after render", function() {59 it("should remove the min attribute from the inputEl", function() {60 create(defaultConfig);61 render();62 field.setMinValue(null);63 expect(field.getComponent().inputElement.getAttribute('min')).toBeNull();64 });65 });66 });67 });68 });69 describe("maxValue", function() {70 var defaultConfig = {71 maxValue: 1072 };73 describe("configuration", function() {74 it("should add the max attribute to the inputEl", function() {75 create(defaultConfig);76 render();77 expect(field.getComponent().inputElement.getAttribute('max')).toEqual('10');78 });79 });80 describe("method", function() {81 describe("setting", function() {82 describe("before render", function() {83 it("should add the max attribute to the inputEl", function() {84 create();85 field.setMaxValue(10);86 render();87 expect(field.getComponent().inputElement.getAttribute('max')).toEqual('10');88 });89 });90 describe("after render", function() {91 it("should add the max attribute to the inputEl", function() {92 create();93 render();94 field.setMaxValue(10);95 expect(field.getComponent().inputElement.getAttribute('max')).toEqual('10');96 });97 });98 });99 describe("removing", function() {100 describe("before render", function() {101 it("should remove the max attribute from the inputEl", function() {102 create(defaultConfig);103 field.setMaxValue(null);104 render();105 expect(field.getComponent().inputElement.getAttribute('max')).toBeNull();106 });107 });108 describe("after render", function() {109 it("should remove the max attribute from the inputEl", function() {110 create(defaultConfig);111 render();112 field.setMaxValue(null);113 expect(field.getComponent().inputElement.getAttribute('max')).toBeNull();114 });115 });116 });117 });118 });119 describe("stepValue", function() {120 var defaultConfig = {121 stepValue: 10122 };123 describe("configuration", function() {124 it("should add the step attribute to the inputEl", function() {125 create(defaultConfig);126 render();127 expect(field.getComponent().inputElement.getAttribute('step')).toEqual('10');128 });129 });130 describe("method", function() {131 describe("setting", function() {132 describe("before render", function() {133 it("should add the step attribute to the inputEl", function() {134 create();135 field.setStepValue(10);136 render();137 expect(field.getComponent().inputElement.getAttribute('step')).toEqual('10');138 });139 });140 describe("after render", function() {141 it("should add the step attribute to the inputEl", function() {142 create();143 render();144 field.setStepValue(10);145 expect(field.getComponent().inputElement.getAttribute('step')).toEqual('10');146 });147 });148 });149 describe("removing", function() {150 describe("before render", function() {151 it("should remove the step attribute from the inputEl", function() {152 create(defaultConfig);153 field.setStepValue(null);154 render();155 expect(field.getComponent().inputElement.getAttribute('step')).toBeNull();156 });157 });158 describe("after render", function() {159 it("should remove the step attribute from the inputEl", function() {160 create(defaultConfig);161 render();162 field.setStepValue(null);163 expect(field.getComponent().inputElement.getAttribute('step')).toBeNull();164 });165 });166 });167 });168 });169 });...

Full Screen

Full Screen

SVGAnimatedEnumeration-SVGFEDisplacementMapElement.js

Source:SVGAnimatedEnumeration-SVGFEDisplacementMapElement.js Github

copy

Full Screen

1description("This test checks the use of SVGAnimatedEnumeration within SVGFEDisplacementMapElement");2var feDisplacementMapElement = document.createElementNS("http://www.w3.org/2000/svg", "feDisplacementMap");3feDisplacementMapElement.setAttribute("xChannelSelector", "R");4feDisplacementMapElement.setAttribute("yChannelSelector", "R");5// xChannelSelector6debug("");7debug("Check initial 'xChannelSelector' value");8shouldBeEqualToString("feDisplacementMapElement.xChannelSelector.toString()", "[object SVGAnimatedEnumeration]");9shouldBeEqualToString("typeof(feDisplacementMapElement.xChannelSelector.baseVal)", "number");10shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");11debug("");12debug("Switch to 'G'");13shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_G", "SVGFEDisplacementMapElement.SVG_CHANNEL_G");14shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_G");15shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "G");16debug("");17debug("Switch to 'B'");18shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_B", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");19shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");20shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "B");21debug("");22debug("Switch to 'A'");23shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_A", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");24shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");25shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "A");26debug("");27debug("Try setting invalid values");28shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = 5");29shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");30shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "A");31shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = -1");32shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");33shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "A");34shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = 0");35shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");36shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "A");37debug("");38debug("Switch to 'R'");39shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_R", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");40shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");41shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')", "R");42// yChannelSelector43debug("");44debug("Check initial 'yChannelSelector' value");45shouldBeEqualToString("feDisplacementMapElement.yChannelSelector.toString()", "[object SVGAnimatedEnumeration]");46shouldBeEqualToString("typeof(feDisplacementMapElement.yChannelSelector.baseVal)", "number");47shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");48debug("");49debug("Switch to 'G'");50shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_G", "SVGFEDisplacementMapElement.SVG_CHANNEL_G");51shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_G");52shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "G");53debug("");54debug("Switch to 'B'");55shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_B", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");56shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");57shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "B");58debug("");59debug("Switch to 'A'");60shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_A", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");61shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");62shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "A");63debug("");64debug("Try setting invalid values");65shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = 5");66shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");67shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "A");68shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = -1");69shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");70shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "A");71shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = 0");72shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");73shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "A");74debug("");75debug("Switch to 'R'");76shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_R", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");77shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");78shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')", "R");...

Full Screen

Full Screen

jquery.unobtrusive-ajax.js

Source:jquery.unobtrusive-ajax.js Github

copy

Full Screen

...30 var mode;31 if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us32 return;33 }34 mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase();35 $(element.getAttribute("data-ajax-update")).each(function (i, update) {36 var top;37 switch (mode) {38 case "BEFORE":39 top = update.firstChild;40 $("<div />").html(data).contents().each(function () {41 update.insertBefore(this, top);42 });43 break;44 case "AFTER":45 $("<div />").html(data).contents().each(function () {46 update.appendChild(this);47 });48 break;49 default:50 $(update).html(data);51 break;52 }53 });54 }55 function asyncRequest(element, options) {56 var confirm, loading, method, duration;57 confirm = element.getAttribute("data-ajax-confirm");58 if (confirm && !window.confirm(confirm)) {59 return;60 }61 loading = $(element.getAttribute("data-ajax-loading"));62 duration = element.getAttribute("data-ajax-loading-duration") || 0;63 $.extend(options, {64 type: element.getAttribute("data-ajax-method") || undefined,65 url: element.getAttribute("data-ajax-url") || undefined,66 beforeSend: function (xhr) {67 var result;68 asyncOnBeforeSend(xhr, method);69 result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments);70 if (result !== false) {71 loading.show(duration);72 }73 return result;74 },75 complete: function () {76 loading.hide(duration);77 getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments);78 },79 success: function (data, status, xhr) {80 asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html");81 getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments);82 },83 error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"])84 });85 options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" });86 method = options.type.toUpperCase();87 if (!isMethodProxySafe(method)) {88 options.type = "POST";89 options.data.push({ name: "X-HTTP-Method-Override", value: method });90 }91 $.ajax(options);92 }93 function validate(form) {94 var validationInfo = $(form).data(data_validation);95 return !validationInfo || !validationInfo.validate || validationInfo.validate();96 }97 $(document).on("click", "a[data-ajax=true]", function (evt) {...

Full Screen

Full Screen

EntityGenerator.js

Source:EntityGenerator.js Github

copy

Full Screen

1BASE.require([2 "node.File",3 "node.Directory"4], function () {5 BASE.namespace("elPocoLoco");6 var Future = BASE.async.Future;7 var Task = BASE.async.Task;8 var File = node.File;9 var Directory = node.Directory;10 var toArray = function (arrayLike) {11 return Array.prototype.slice.call(arrayLike, 0);12 };13 var defaultValues = {14 "Edm.Int64": 0,15 "Edm.DateTime": null,16 "Edm.Decimal": 0,17 "Edm.String": null,18 "Edm.Boolean": false,19 };20 var edmToJavascript = {21 "Edm.Int64": "Number",22 "Edm.DateTime": "Date",23 "Edm.Decimal": "Number",24 "Edm.String": "String",25 "Edm.Boolean": "Boolean",26 }27 var getDefaultValue = function (propertyElement) {28 var nullable = propertyElement.getAttribute("Nullable");29 var type = propertyElement.getAttribute("Type");30 var name = propertyElement.getAttribute("Name");31 if (nullable || name === "Id") {32 return null;33 } else {34 return defaultValues[type] || null;35 }36 };37 elPocoLoco.EntityGenerator = function (dom, templateCache) {38 var self = this;39 var buildEntity = function (entityElement, namespaceArray) {40 return new Future(function (setValue, setError) {41 var task = new Task();42 task.add(43 templateCache.get("./PocoTemplate.js"),44 templateCache.get("./PropertyTemplate.js")45 );46 task.start().whenAll(function (futures) {47 var pocoTemplate = futures[0].value;48 var propertyTemplate = futures[1].value;49 var mirrorTemplate = futures[2].value;50 var definePropertiesTemplate = futures[3].value;51 var className = entityElement.getAttribute("Name");52 var fullNamespaceArray = namespaceArray.slice(0);53 var fullNamespace = fullNamespaceArray.join(".");54 var baseClassName = entityElement.getAttribute("BaseType") || "Object";55 var dependencies = [baseClassName];56 var properties = [];57 fullNamespaceArray.push(className);58 toArray(entityElement.querySelectorAll("Property")).forEach(function (propertyElement) {59 var property = propertyElement.getAttribute("Name");60 var Type = propertyElement.getAttribute("Type");61 properties.push(propertyTemplate.createInstance({62 property: property,63 value: getDefaultValue(propertyElement)64 }));65 });66 var poco = pocoTemplate.createInstance({67 dependencies: "[\"" + dependencies.join("\",\"") + "\"]",68 baseName: baseClassName,69 namespace: namespaceArray.join("."),70 className: className,71 properties: properties.join("\r\n\t\t")72 });73 setValue(poco);74 });75 });76 };77 self.generate = function () {78 return new Future(function (setValue, setError) {79 toArray(dom.querySelectorAll("Schema")).forEach(function (schemaElement) {80 var namespace = schemaElement.getAttribute("Namespace");81 var namespaceArray = namespace.split(".");82 new Directory(namespace.replace(/\./g, "/")).create().then(function () {83 var task = new Task();84 toArray(schemaElement.querySelectorAll("EntityType")).forEach(function (entityElement) {85 task.add(new Future(function (setValue, setError) {86 var className = entityElement.getAttribute("Name");87 var fullNamespaceArray = namespaceArray.slice(0);88 fullNamespaceArray.push(className);89 var path = fullNamespaceArray.join("/") + ".js";90 buildEntity(entityElement, namespaceArray).then(function (file) {91 new File(path).write(file).then(setValue).ifError(setError);92 });93 }));94 });95 task.start().whenAll(setValue);96 });97 });98 });99 };100 };...

Full Screen

Full Screen

SVGAnimatedEnumeration-SVGGradientElement.js

Source:SVGAnimatedEnumeration-SVGGradientElement.js Github

copy

Full Screen

1description("This test checks the use of SVGAnimatedEnumeration within SVGGradientElement");2var gradientElement = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");3gradientElement.setAttribute("gradientUnits", "userSpaceOnUse");4gradientElement.setAttribute("spreadMethod", "pad");5// gradientUnits6debug("");7debug("Check initial 'gradientUnits' value");8shouldBeEqualToString("gradientElement.gradientUnits.toString()", "[object SVGAnimatedEnumeration]");9shouldBeEqualToString("typeof(gradientElement.gradientUnits.baseVal)", "number");10shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");11debug("");12debug("Switch to 'objectBoundingBox'");13shouldBe("gradientElement.gradientUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");14shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");15shouldBeEqualToString("gradientElement.getAttribute('gradientUnits')", "objectBoundingBox");16debug("");17debug("Try setting invalid values");18shouldThrow("gradientElement.gradientUnits.baseVal = 3");19shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");20shouldBeEqualToString("gradientElement.getAttribute('gradientUnits')", "objectBoundingBox");21shouldThrow("gradientElement.gradientUnits.baseVal = -1");22shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");23shouldBeEqualToString("gradientElement.getAttribute('gradientUnits')", "objectBoundingBox");24shouldThrow("gradientElement.gradientUnits.baseVal = 0");25shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");26shouldBeEqualToString("gradientElement.getAttribute('gradientUnits')", "objectBoundingBox");27debug("");28debug("Switch to 'userSpaceOnUse'");29shouldBe("gradientElement.gradientUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");30shouldBe("gradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");31shouldBeEqualToString("gradientElement.getAttribute('gradientUnits')", "userSpaceOnUse");32// spreadMethod33debug("");34debug("Check initial 'spreadMethod' value");35shouldBeEqualToString("gradientElement.spreadMethod.toString()", "[object SVGAnimatedEnumeration]");36shouldBeEqualToString("typeof(gradientElement.spreadMethod.baseVal)", "number");37shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_PAD");38debug("");39debug("Switch to 'reflect' value");40shouldBe("gradientElement.spreadMethod.baseVal = SVGGradientElement.SVG_SPREADMETHOD_REFLECT", "SVGGradientElement.SVG_SPREADMETHOD_REFLECT");41shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_REFLECT");42shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "reflect");43debug("");44debug("Switch to 'repeat' value");45shouldBe("gradientElement.spreadMethod.baseVal = SVGGradientElement.SVG_SPREADMETHOD_REPEAT", "SVGGradientElement.SVG_SPREADMETHOD_REPEAT");46shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_REPEAT");47shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "repeat");48debug("");49debug("Try setting invalid values");50shouldThrow("gradientElement.spreadMethod.baseVal = 4");51shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_REPEAT");52shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "repeat");53shouldThrow("gradientElement.spreadMethod.baseVal = -1");54shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_REPEAT");55shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "repeat");56shouldThrow("gradientElement.spreadMethod.baseVal = 0");57shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_REPEAT");58shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "repeat");59debug("");60debug("Switch to 'pad'");61shouldBe("gradientElement.spreadMethod.baseVal = SVGGradientElement.SVG_SPREADMETHOD_PAD", "SVGGradientElement.SVG_SPREADMETHOD_PAD");62shouldBe("gradientElement.spreadMethod.baseVal", "SVGGradientElement.SVG_SPREADMETHOD_PAD");63shouldBeEqualToString("gradientElement.getAttribute('spreadMethod')", "pad");...

Full Screen

Full Screen

editor_plugin.js

Source:editor_plugin.js Github

copy

Full Screen

1// Import theme specific language pack 2tinyMCE.importPluginLanguagePack('ibrowser', 'uk,de');3// Returns the HTML contents of the ibrowser control.4function TinyMCE_ibrowser_getControlHTML(control_name) {5 switch (control_name) {6 case "ibrowser":7 return '<img id="{$editor_id}_ibrowser" src="{$pluginurl}/images/ibrowser.gif" title="{$lang_ibrowser_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceBrowseImage\');">';8 }9 return "";10}11// Executes the mceBrowseImage command.12function TinyMCE_ibrowser_execCommand(editor_id, element, command, user_interface, value) {13 // Handle commands14 switch (command) {15 case "mceBrowseImage":16 var template = new Array();17 template['file'] = '../../plugins/ibrowser/ibrowser.php'; // Relative to theme location18 template['width'] = 480;19 template['height'] = 670;20 var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";21 if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")22 tinyMCE.imgElement = tinyMCE.selectedElement;23 if (tinyMCE.imgElement) {24 src = tinyMCE.imgElement.getAttribute('src') ? tinyMCE.imgElement.getAttribute('src') : "";25 alt = tinyMCE.imgElement.getAttribute('alt') ? tinyMCE.imgElement.getAttribute('alt') : "";26 border = tinyMCE.imgElement.getAttribute('border') ? tinyMCE.imgElement.getAttribute('border') : "";27 hspace = tinyMCE.imgElement.getAttribute('hspace') ? tinyMCE.imgElement.getAttribute('hspace') : "";28 vspace = tinyMCE.imgElement.getAttribute('vspace') ? tinyMCE.imgElement.getAttribute('vspace') : "";29 width = tinyMCE.imgElement.getAttribute('width') ? tinyMCE.imgElement.getAttribute('width') : "";30 height = tinyMCE.imgElement.getAttribute('height') ? tinyMCE.imgElement.getAttribute('height') : "";31 align = tinyMCE.imgElement.getAttribute('align') ? tinyMCE.imgElement.getAttribute('align') : "";32 // Fix for drag-drop/copy paste bug in Mozilla33 mceRealSrc = tinyMCE.imgElement.getAttribute('mce_real_src') ? tinyMCE.imgElement.getAttribute('mce_real_src') : "";34 if (mceRealSrc != "")35 src = mceRealSrc;36 src = eval(tinyMCE.settings['urlconvertor_callback'] + "(src, tinyMCE.imgElement, true);");37 }38 tinyMCE.openWindow(template, {editor_id : editor_id, src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align});39 return true;40 }41 // Pass to next handler in chain42 return false;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .withCapabilities({4 })5 .build();6driver.manage().timeouts().implicitlyWait(10000);7driver.findElement(webdriver.By.id('io.appium.android.apis:id/animation')).click();8driver.findElement(webdriver.By.id('io.appium.android.apis:id/flipper')).click();9driver.findElement(webdriver.By.id('io.appium.android.apis:id/flip')).click();10driver.findElement(webdriver.By.id('io.appium.android.apis:id/flip')).getAttribute('checked').then(function(text){11 console.log(text);12});13driver.quit();14driver.findElement(webdriver.By.id('id_of_element')).getText().then(function(text){15 console.log(text);16});17driver.findElement(webdriver.By.id('id_of_element')).getText().then(function(text){18 console.log(text);19});20driver.findElement(webdriver.By.id('id_of_element')).getText().then(function(text){21 console.log(text);22});23driver.findElement(webdriver.By.id('id_of_element')).getText().then(function(text){24 console.log(text);25});

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();3var element = driver.findElement(webdriver.By.name('q'));4element.getAttribute('name').then(function(value) {5 console.log(value);6});7driver.quit();8var element = driver.findElement(webdriver.By.name('q'));9element.getAttribute('value').then(function(value) {10 console.log(value);11});12driver.quit();13var element = driver.findElement(webdriver.By.name('q'));14element.getAttribute('class').then(function(value) {15 console.log(value);16});17driver.quit();18var element = driver.findElement(webdriver.By.name('q'));19element.getAttribute('id').then(function(value) {20 console.log(value);21});22driver.quit();23var element = driver.findElement(webdriver.By.name('q'));24element.getAttribute('type').then(function(value) {25 console.log(value);26});27driver.quit();28var element = driver.findElement(webdriver.By.name('q'));29element.getAttribute('href').then(function(value) {30 console.log(value);31});32driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id("com.android.calculator2:id/digit_2"));2var attribute = element.getAttribute("contentDescription");3console.log(attribute);4var element = driver.findElement(By.id("com.android.calculator2:id/digit_2"));5var attribute = element.getAttribute("contentDescription");6console.log(attribute);7var element = driver.$("#com.android.calculator2:id/digit_2");8var attribute = element.getAttribute("contentDescription");9console.log(attribute);10var element = element(by.id("com.android.calculator2:id/digit_2"));11var attribute = element.getAttribute("contentDescription");12console.log(attribute);13var element = page.locator("#com.android.calculator2:id/digit_2");14var attribute = element.getAttribute("contentDescription");15console.log(attribute);16var element = page.$("#com.android.calculator2:id/digit_2");17var attribute = element.getAttribute("contentDescription");18console.log(attribute);19var element = cy.get("#com.android.calculator2:id/digit_2");20var attribute = element.getAttribute("contentDescription");21console.log(attribute);22var element = Selector("#com.android.calculator2:id/digit_2");23var attribute = element.getAttribute("contentDescription");24console.log(attribute);25var element = browser.element("#com.android.calculator2:id/digit_2");26var attribute = element.getAttribute("contentDescription");27console.log(attribute);28var element = driver.findElement(By.id("com.android.calculator2:id/digit_2"));29var attribute = element.getAttribute("contentDescription");30console.log(attribute);31var element = driver.$("#com.android.calculator2:id/digit_2");32var attribute = element.getAttribute("contentDescription");33console.log(attribute);34var element = nightmare.element("#com.android.calculator2:id/digit_2");35var attribute = element.getAttribute("contentDescription");36console.log(attribute);

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));2var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));3var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));4var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));5var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));6var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));7var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));8element.getAttribute('contentSize

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));2element.getAttribute('text').then(function(text){3console.log('The text of the element is: ' + text)4});5var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));6element.getText().then(function(text){7console.log('The text of the element is: ' + text)8});9var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));10element.getAttribute('text').then(function(text){11console.log('The text of the element is: ' + text)12});13var element = driver.findElement(By.id('com.example.android.contactmanager:id/addContactButton'));14element.getText().then(function(text){15console.log('The text of the element is: ' + text)16});

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));2var text = element.getAttribute("text");3console.log(text);4var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));5var text = element.getAttribute("text");6console.log(text);7var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));8var text = element.getAttribute("text");9console.log(text);10var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));11var text = element.getAttribute("text");12console.log(text);13var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));14var text = element.getAttribute("text");15console.log(text);16var element = driver.findElement(By.id('com.example.android.contactmanager:id/contactSaveButton'));17var text = element.getAttribute("text");18console.log(text);19var element = driver.findElement(By.id('com.example.android

Full Screen

Using AI Code Generation

copy

Full Screen

1var element = driver.findElement(By.id("ID of element"));2var attributeValue = element.getAttribute("attribute to retrieve");3console.log("The attribute value is : " + attributeValue);4var element = driver.findElement(By.id("ID of element"));5var textValue = element.getText();6console.log("The text value is : " + textValue);7var element = driver.findElement(By.id("ID of element"));8var tagName = element.getTagName();9console.log("The tag name is : " + tagName);10var element = driver.findElement(By.id("ID of element"));11var size = element.getSize();12console.log("The size is : " + size);13var element = driver.findElement(By.id("ID of element"));14var location = element.getLocation();15console.log("The location is : " + location);16var element = driver.findElement(By.id("ID of element"));17var isDisplayed = element.isDisplayed();18console.log("The element is displayed :

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