How to use complete method in argos

Best JavaScript code snippet using argos

ui-autocomplete.js

Source:ui-autocomplete.js Github

copy

Full Screen

...420 enumerable: true,421 configurable: true422 });423 RadAutoCompleteTextView.prototype.resetAutoComplete = function () {424 this._android.resetAutocomplete();425 };426 RadAutoCompleteTextView.prototype.addToken = function (token) {427 var image = token.image ? RadAutoCompleteTextView.resolveDrawableFromResource(token.image) : null;428 var nativeObject = new com.telerik.widget.autocomplete.TokenModel(token.text, image);429 this._android.addTokenView(nativeObject);430 if (this._android.getDisplayMode() === com.telerik.widget.autocomplete.DisplayMode.PLAIN) {431 // HACK: to unify behavior in iOS and Android432 this._android.setText(token.text);433 }434 };435 RadAutoCompleteTextView.prototype.insertTokenAtIndex = function (token, index) {436 var image = token.image ? RadAutoCompleteTextView.resolveDrawableFromResource(token.image) : null;437 var nativeObject = new com.telerik.widget.autocomplete.TokenModel(token.text, image);438 var nativeTokenView = new com.telerik.widget.autocomplete.TokenView(this._context);...

Full Screen

Full Screen

konytextfieldautocomplete.js

Source:konytextfieldautocomplete.js Github

copy

Full Screen

1/************************ TEXT FIELD AUTO COMPLETE *******************/2$KW.TextField.AutoComplete = {3 /**4 * Global vars5 */6 __AutoCompleteClass : 'autocomplete_base',7 __AutoComplete : new Array(),8 __AutoCompleteElementId : null,9 // Basic UA detection10 isIE : document.all ? true : false,11 isGecko : navigator.userAgent.toLowerCase().indexOf('gecko') != -1,12 isOpera : navigator.userAgent.toLowerCase().indexOf('opera') != -1,13 AutoSuggestOrientation: function(){14 if(this.__AutoCompleteElementId != null) {15 this.AutoComplete_HideAll();16 // AutoComplete_CreateDropdown(__AutoCompleteElementId)17 this.AutoComplete_CreateDropdownZeroSize(this.__AutoCompleteElementId);18 this.AutoComplete_ShowDropdown(this.__AutoCompleteElementId);19 this.AutoComplete_HideAll();20 this.AutoComplete_CreateDropdown(this.__AutoCompleteElementId);21 this.AutoComplete_ShowDropdown(this.__AutoCompleteElementId);22 //AutoComplete_HideAll()23 }24 },25 /**26 * Attachs the autocomplete object to a form element. Sets27 * onkeypress event on the form element.28 *29 * @param string formElement Name of form element to attach to30 * @param array data Array of strings of which to use as the autocomplete data31 */32 AutoComplete_Create:function(id, data){33 this.__AutoComplete[id] = {'data':data,34 'isVisible':false,35 'element':document.getElementById(id),36 'dropdown':null,37 'highlighted':null,38 'styleclass':this.__AutoCompleteClass};39 this.__AutoComplete[id]['element'].setAttribute(this.__AutoCompleteClass, 'off');40 this.__AutoComplete[id]['element'].onkeydown = function(e) {return $KW.TextField.AutoComplete.AutoComplete_KeyDown(this.getAttribute('id'), e);}41 this.__AutoComplete[id]['element'].onkeyup = function(e) {return $KW.TextField.AutoComplete.AutoComplete_KeyUp(this.getAttribute('id'), e);}42 this.__AutoComplete[id]['element'].onkeypress = function(e) {if (!e) e = window.event; if (e.keyCode == 13 || this.isOpera) return false;}43 this.__AutoComplete[id]['element'].ondblclick = function() {$KW.TextField.AutoComplete.AutoComplete_ShowDropdown(this.getAttribute('id'));}44 this.__AutoComplete[id]['element'].onclick = function(e) {if (!e) e = window.event; e.cancelBubble = true; e.returnValue = false;}45 // Hides the dropdowns when document clicked46 var docClick = function()47 {48 for (id in this.__AutoComplete) {49 $KW.TextField.AutoComplete.AutoComplete_HideDropdown(id);50 }51 }52 if (document.addEventListener) {53 document.addEventListener('click', docClick, false);54 } else if (document.attachEvent) {55 document.attachEvent('onclick', docClick, false);56 }57 // Max number of items shown at once58 if (arguments[2] != null) {59 this.__AutoComplete[id]['maxitems'] = arguments[2];60 this.__AutoComplete[id]['firstItemShowing'] = 0;61 this.__AutoComplete[id]['lastItemShowing'] = arguments[2] - 1;62 }63 this.AutoComplete_CreateDropdown(id);64 // Prevent select dropdowns showing thru65 if (this.isIE) {66 this.__AutoComplete[id]['iframe'] = document.createElement('iframe');67 this.__AutoComplete[id]['iframe'].id = id +'_iframe';68 this.__AutoComplete[id]['iframe'].style.position = 'absolute';69 this.__AutoComplete[id]['iframe'].style.top = '0';70 this.__AutoComplete[id]['iframe'].style.left = '0';71 this.__AutoComplete[id]['iframe'].style.width = '0px';72 this.__AutoComplete[id]['iframe'].style.height = '0px';73 this.__AutoComplete[id]['iframe'].style.zIndex = '98';74 this.__AutoComplete[id]['iframe'].style.visibility = 'hidden';75 this.__AutoComplete[id]['element'].parentNode.insertBefore(this.__AutoComplete[id]['iframe'], this.__AutoComplete[id]['element']);76 }77 },78 /**79 * Creates the dropdown layer80 *81 * @param string id The form elements id. Used to identify the correct dropdown.82 */83 AutoComplete_CreateDropdown:function(id){84 var left = this.AutoComplete_GetLeft(this.__AutoComplete[id]['element']);85 var top = this.AutoComplete_GetTop(this.__AutoComplete[id]['element']) + this.__AutoComplete[id]['element'].offsetHeight;86 var width = this.__AutoComplete[id]['element'].offsetWidth;87 //alert(left)88 this.__AutoComplete[id]['dropdown'] = document.createElement('div');89 this.__AutoComplete[id]['dropdown'].className = this.__AutoCompleteClass; // Don't use setAttribute()90 91 this.AutoComplete_RemoveDivs(id);92 this.__AutoComplete[id]['element'].parentNode.insertBefore(this.__AutoComplete[id]['dropdown'], this.__AutoComplete[id]['element']);93 // Position it94 this.__AutoComplete[id]['dropdown'].style.left = left + 'px';95 this.__AutoComplete[id]['dropdown'].style.top = top + 'px';96 this.__AutoComplete[id]['dropdown'].style.width = width + 'px';97 this.__AutoComplete[id]['dropdown'].style.zIndex = '99';98 this.__AutoComplete[id]['dropdown'].style.visibility = 'hidden';99 100 //override autocomplete styles101 var el = document.getElementById(id);102 if(el.getAttribute('autosuggestskin') != null) {103 this.__AutoComplete[id]['styleclass'] = el.getAttribute('autosuggestskin');104 this.__AutoComplete[id]['dropdown'].className = this.__AutoComplete[id]['styleclass'];105 this.__AutoComplete[id]['dropdown'].style.position='absolute';106 this.__AutoComplete[id]['dropdown'].style.borderStyle='solid';107 this.__AutoComplete[id]['dropdown'].style.borderWidth='1px';108 this.__AutoComplete[id]['dropdown'].style.borderColor='black';109 this.__AutoComplete[id]['dropdown'].style.backgroundColor='white';110 this.__AutoComplete[id]['dropdown'].style.overflow='auto';111 this.__AutoComplete[id]['dropdown'].style.overflowX='hidden';112 113 }114 else115 {116 this.__AutoComplete[id]['dropdown'].style.fontFamily= this.getElementStyle(el,'font-family');117 this.__AutoComplete[id]['dropdown'].style.fontSize= this.getElementStyle(el,'font-size');118 this.__AutoComplete[id]['dropdown'].style.fontStyle= this.getElementStyle(el,'font-style');119 this.__AutoComplete[id]['dropdown'].style.fontWeight= this.getElementStyle(el,'font-weight');120 this.__AutoComplete[id]['dropdown'].style.color= this.getElementStyle(el,'color');121 }122 this.AutoComplete_RemoveDivs(id);123 this.__AutoComplete[id]['element'].parentNode.insertBefore(this.__AutoComplete[id]['dropdown'], this.__AutoComplete[id]['element']);124 },125 126 getElementStyle:function(el,styleProp){ 127 var elementstyle = null;128 if (el.currentStyle)129 elementstyle = el.currentStyle[styleProp];130 else if (window.getComputedStyle)131 elementstyle = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);132 return elementstyle;133 },134 135 AutoComplete_RemoveDivs : function(id) {136 var autoCompleteParent = document.getElementById(id).parentNode;137 if(this.__AutoComplete[id]) {138 var autoCompleteDivs = document.getElementsByClassName(this.__AutoComplete[id]['styleclass']);139 if(autoCompleteDivs.length>0){140 for( var i = 0; i< autoCompleteDivs.length;i++){141 if(autoCompleteDivs[i].nextSibling.id === id)142 autoCompleteParent.removeChild(autoCompleteDivs[i]);143 }144 }145 }146 },147 /* TODO: Need to verify below values are correct or not.*/148 AutoComplete_CreateDropdownZeroSize:function(id){149 // Position it150 this.__AutoComplete[id]['dropdown'].style.left = '1px';151 this.__AutoComplete[id]['dropdown'].style.top = '1px';152 this.__AutoComplete[id]['dropdown'].style.width = '10px';153 this.__AutoComplete[id]['dropdown'].style.zIndex = '99';154 this.__AutoComplete[id]['dropdown'].style.visibility = 'hidden';155 },156 /**157 * Gets left coord of given element158 *159 * @param object element The element to get the left coord for160 */161 AutoComplete_GetLeft:function(element)162 {163 var curNode = element;164 var left = 0;165 do {166 left += curNode.offsetLeft;167 curNode = curNode.offsetParent;168 } while(curNode.tagName.toLowerCase() != 'body');169 return left;170 },171 /**172 * Gets top coord of given element173 *174 * @param object element The element to get the top coord for175 */176 AutoComplete_GetTop:function(element)177 {178 var curNode = element;179 var top = 0;180 do {181 top += curNode.offsetTop;182 curNode = curNode.offsetParent;183 } while(curNode.tagName.toLowerCase() != 'body');184 return top;185 },186 /**187 * Shows the dropdown layer188 *189 * @param string id The form elements id. Used to identify the correct dropdown.190 */191 AutoComplete_ShowDropdown:function(id)192 {193 this.AutoComplete_HideAll();194 this.__AutoCompleteElementId = id;195 var value = this.__AutoComplete[id]['element'].value;196 var toDisplay = new Array();197 var newDiv = null;198 var text = null;199 var numItems = this.__AutoComplete[id]['dropdown'].childNodes.length;200 // Remove all child nodes from dropdown201 while (this.__AutoComplete[id]['dropdown'].childNodes.length > 0) {202 this.__AutoComplete[id]['dropdown'].removeChild(this.__AutoComplete[id]['dropdown'].childNodes[0]);203 }204 // Go thru data searching for matches205 value = value.ltrim().toUpperCase();206 for (i=0; i<this.__AutoComplete[id]['data'].length; ++i) {207 if (this.__AutoComplete[id]['data'][i].toUpperCase().indexOf(value) != -1) {208 toDisplay[toDisplay.length] = this.__AutoComplete[id]['data'][i];209 }210 }211 // No matches?212 if (toDisplay.length == 0) {213 this.AutoComplete_HideDropdown(id);214 return;215 }216 var target = document.getElementById(id);217 var space = target.getAttribute('suggestionspace');218 if(space)219 space = parseInt(space)/2;220 // Add data to the dropdown layer221 for (i=0; i<toDisplay.length; ++i) {222 newDiv = document.createElement('div');223 newDiv.className = 'autocomplete_item'; // Don't use setAttribute()224 newDiv.setAttribute('id', 'autocomplete_item_' + i);225 newDiv.setAttribute('index', i);226 newDiv.style.zIndex = '99';227 // Scrollbars are on display ?228 if (toDisplay.length > this.__AutoComplete[id]['maxitems'] && navigator.userAgent.indexOf('MSIE') == -1) {229 newDiv.style.width = this.__AutoComplete[id]['element'].offsetWidth - 22 + 'px';230 }231 newDiv.onmouseover = function() {$KW.TextField.AutoComplete.AutoComplete_HighlightItem($KW.TextField.AutoComplete.__AutoComplete[id]['element'].getAttribute('id'), this.getAttribute('index'));};232 newDiv.onclick = function() {$KW.TextField.AutoComplete.AutoComplete_SetValue($KW.TextField.AutoComplete.__AutoComplete[id]['element'].getAttribute('id')); $KW.TextField.AutoComplete.AutoComplete_RemoveDivs(id);}233 text = document.createTextNode(toDisplay[i]);234 newDiv.appendChild(text);235 this.AutoComplete_HideAllDropdowns()236 237 if(space){238 newDiv.style.paddingBottom=space+"px";239 newDiv.style.paddingTop=space+"px";240 }241 this.__AutoComplete[id]['dropdown'].appendChild(newDiv);242 }243 // Too many items?244 if (toDisplay.length > this.__AutoComplete[id]['maxitems']) {245 this.__AutoComplete[id]['dropdown'].style.height = (this.__AutoComplete[id]['maxitems'] * 15) + 2 + 'px';246 } else {247 this.__AutoComplete[id]['dropdown'].style.height = '';248 }249 /**250 * Set left/top in case of document movement/scroll/window resize etc251 */252 this.__AutoComplete[id]['dropdown'].style.left = this.AutoComplete_GetLeft(this.__AutoComplete[id]['element']) + 'px';253 this.__AutoComplete[id]['dropdown'].style.top = this.AutoComplete_GetTop(this.__AutoComplete[id]['element']) + this.__AutoComplete[id]['element'].offsetHeight + 'px';254 // Show the iframe for IE255 if (this.isIE) {256 this.__AutoComplete[id]['iframe'].style.top = this.__AutoComplete[id]['dropdown'].style.top;257 this.__AutoComplete[id]['iframe'].style.left = this.__AutoComplete[id]['dropdown'].style.left;258 this.__AutoComplete[id]['iframe'].style.width = this.__AutoComplete[id]['dropdown'].offsetWidth;259 this.__AutoComplete[id]['iframe'].style.height = this.__AutoComplete[id]['dropdown'].offsetHeight;260 this.__AutoComplete[id]['iframe'].style.visibility = 'visible';261 }262 // Show dropdown263 if (!this.__AutoComplete[id]['isVisible']) {264 this.__AutoComplete[id]['dropdown'].style.visibility = 'visible';265 this.__AutoComplete[id]['isVisible'] = true;266 }267 // If now showing less items than before, reset the highlighted value268 if (this.__AutoComplete[id]['dropdown'].childNodes.length != numItems) {269 this.__AutoComplete[id]['highlighted'] = null;270 }271 },272 /**273 * Hides the dropdown layer274 *275 * @param string id The form elements id. Used to identify the correct dropdown.276 */277 AutoComplete_HideDropdown:function(id)278 {279 if (this.__AutoComplete[id]['iframe']) {280 this.__AutoComplete[id]['iframe'].style.visibility = 'hidden';281 }282 if(this.__AutoComplete[id]['dropdown']) {283 this.__AutoComplete[id]['dropdown'].style.visibility = 'hidden';284 }285 this.__AutoComplete[id]['highlighted'] = null;286 this.__AutoComplete[id]['isVisible'] = false;287 },288 /**289 * Hides all dropdowns290 */291 AutoComplete_HideAll:function()292 {293 for (id in this.__AutoComplete) {294 this.AutoComplete_HideDropdown(id);295 }296 },297 AutoComplete_HideAllDropdowns:function(){298 var autocompdivs = document.getElementsByClassName(this.__AutoComplete[id]['styleclass']);299 if(autocompdivs != null) {300 for(var i=0;i<autocompdivs.length;i++) {301 autocompdivs[i].style.visibility = 'hidden';302 }303 }304 },305 /**306 * Highlights a specific item307 *308 * @param string id The form elements id. Used to identify the correct dropdown.309 * @param int index The index of the element in the dropdown to highlight310 */311 AutoComplete_HighlightItem:function(id, index)312 {313 if (this.__AutoComplete[id]['dropdown'].childNodes[index]) {314 for (var i=0; i<this.__AutoComplete[id]['dropdown'].childNodes.length; ++i) {315 if (this.__AutoComplete[id]['dropdown'].childNodes[i].className == 'autocomplete_item_highlighted') {316 this.__AutoComplete[id]['dropdown'].childNodes[i].className = 'autocomplete_item';317 }318 }319 this.__AutoComplete[id]['dropdown'].childNodes[index].className = 'autocomplete_item_highlighted';320 this.__AutoComplete[id]['highlighted'] = index;321 }322 },323 /**324 * Highlights the menu item with the given index325 *326 * @param string id The form elements id. Used to identify the correct dropdown.327 * @param int index The index of the element in the dropdown to highlight328 */329 AutoComplete_Highlight:function(id, index)330 {331 // Out of bounds checking332 if (index == 1 && this.__AutoComplete[id]['highlighted'] == this.__AutoComplete[id]['dropdown'].childNodes.length - 1) {333 this.__AutoComplete[id]['dropdown'].childNodes[this.__AutoComplete[id]['highlighted']].className = 'autocomplete_item';334 this.__AutoComplete[id]['highlighted'] = null;335 } else if (index == -1 && this.__AutoComplete[id]['highlighted'] == 0) {336 this.__AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item';337 this.__AutoComplete[id]['highlighted'] = this.__AutoComplete[id]['dropdown'].childNodes.length;338 }339 // Nothing highlighted at the moment340 if (this.__AutoComplete[id]['highlighted'] == null) {341 this.__AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item_highlighted';342 this.__AutoComplete[id]['highlighted'] = 0;343 } else {344 if (this.__AutoComplete[id]['dropdown'].childNodes[this.__AutoComplete[id]['highlighted']]) {345 this.__AutoComplete[id]['dropdown'].childNodes[this.__AutoComplete[id]['highlighted']].className = 'autocomplete_item';346 }347 var newIndex = this.__AutoComplete[id]['highlighted'] + index;348 if (this.__AutoComplete[id]['dropdown'].childNodes[newIndex]) {349 this.__AutoComplete[id]['dropdown'].childNodes[newIndex].className = 'autocomplete_item_highlighted';350 this.__AutoComplete[id]['highlighted'] = newIndex;351 }352 }353 },354 /**355 * Sets the input to a given value356 *357 * @param string id The form elements id. Used to identify the correct dropdown.358 */359 AutoComplete_SetValue:function(id)360 {361 this.__AutoComplete[id]['element'].value = this.__AutoComplete[id]['dropdown'].childNodes[this.__AutoComplete[id]['highlighted']].innerHTML;362 },363 /**364 * Checks if the dropdown needs scrolling365 *366 * @param string id The form elements id. Used to identify the correct dropdown.367 */368 AutoComplete_ScrollCheck:function(id)369 {370 // Scroll down, or wrapping around from scroll up371 if (this.__AutoComplete[id]['highlighted'] > this.__AutoComplete[id]['lastItemShowing']) {372 this.__AutoComplete[id]['firstItemShowing'] = this.__AutoComplete[id]['highlighted'] - (this.__AutoComplete[id]['maxitems'] - 1);373 this.__AutoComplete[id]['lastItemShowing'] = this.__AutoComplete[id]['highlighted'];374 }375 // Scroll up, or wrapping around from scroll down376 if (this.__AutoComplete[id]['highlighted'] < this.__AutoComplete[id]['firstItemShowing']) {377 this.__AutoComplete[id]['firstItemShowing'] = this.__AutoComplete[id]['highlighted'];378 this.__AutoComplete[id]['lastItemShowing'] = this.__AutoComplete[id]['highlighted'] + (this.__AutoComplete[id]['maxitems'] - 1);379 }380 this.__AutoComplete[id]['dropdown'].scrollTop = this.__AutoComplete[id]['firstItemShowing'] * 15;381 },382 /**383 * Function which handles the keypress event384 *385 * @param string id The form elements id. Used to identify the correct dropdown.386 */387 AutoComplete_KeyDown:function(id)388 {389 // Mozilla390 if (arguments[1] != null) {391 event = arguments[1];392 }393 var keyCode = event.keyCode;394 switch (keyCode) {395 // Return/Enter396 case 13:397 if (this.__AutoComplete[id]['highlighted'] != null) {398 this.AutoComplete_SetValue(id);399 this.AutoComplete_HideAllDropdowns();400 }401 /* commented to fix the support ticket #3331. Due to the below code kony ondone event handler associated with KEYDOWN event is not fired.402 event.returnValue = false;403 event.cancelBubble = true;404 */405 break;406 // Escape407 case 27:408 this.AutoComplete_HideAllDropdowns();409 event.returnValue = false;410 event.cancelBubble = true;411 break;412 // Up arrow413 case 38:414 if (!this.__AutoComplete[id]['isVisible']) {415 this.AutoComplete_ShowDropdown(id);416 }417 this.AutoComplete_Highlight(id, -1);418 this.AutoComplete_ScrollCheck(id, -1);419 return false;420 break;421 // Tab422 case 9:423 if (this.__AutoComplete[id]['isVisible']) {424 this.AutoComplete_HideAllDropdowns();425 }426 return;427 // Down arrow428 case 40:429 if (!this.__AutoComplete[id]['isVisible']) {430 this.AutoComplete_ShowDropdown(id);431 }432 this.AutoComplete_Highlight(id, 1);433 this.AutoComplete_ScrollCheck(id, 1);434 return false;435 break;436 }437 },438 /**439 * Function which handles the keyup event440 *441 * @param string id The form elements id. Used to identify the correct dropdown.442 */443 AutoComplete_KeyUp:function(id)444 {445 // Mozilla446 if (arguments[1] != null) {447 event = arguments[1];448 }449 var keyCode = event.keyCode;450 switch (keyCode) {451 case 13:452 event.returnValue = false;453 event.cancelBubble = true;454 break;455 case 27:456 this.AutoComplete_HideAllDropdowns();457 event.returnValue = false;458 event.cancelBubble = true;459 break;460 case 38:461 case 40:462 return false;463 break;464 default:465 this.AutoComplete_ShowDropdown(id);466 break;467 }468 },469 /**470 471 * Returns whether the dropdown is visible472 *473 * @param string id The form elements id. Used to identify the correct dropdown.474 */475 AutoComplete_isVisible:function(id)476 {477 return this__AutoComplete[id]['dropdown'].style.visibility == 'visible';478 }...

Full Screen

Full Screen

ui-autocomplete.common.js

Source:ui-autocomplete.common.js Github

copy

Full Screen

1Object.defineProperty(exports, "__esModule", { value: true });2var view_1 = require("tns-core-modules/ui/core/view");3var builder = require("tns-core-modules/ui/builder");4// Enums5var AutoCompleteDisplayMode;6(function (AutoCompleteDisplayMode) {7 AutoCompleteDisplayMode["Tokens"] = "Tokens";8 AutoCompleteDisplayMode["Plain"] = "Plain";9})(AutoCompleteDisplayMode = exports.AutoCompleteDisplayMode || (exports.AutoCompleteDisplayMode = {}));10var AutoCompleteSuggestMode;11(function (AutoCompleteSuggestMode) {12 AutoCompleteSuggestMode["Suggest"] = "Suggest";13 AutoCompleteSuggestMode["Append"] = "Append";14 AutoCompleteSuggestMode["SuggestAppend"] = "SuggestAppend";15})(AutoCompleteSuggestMode = exports.AutoCompleteSuggestMode || (exports.AutoCompleteSuggestMode = {}));16var AutoCompleteLayoutMode;17(function (AutoCompleteLayoutMode) {18 AutoCompleteLayoutMode["Horizontal"] = "Horizontal";19 AutoCompleteLayoutMode["Wrap"] = "Wrap";20})(AutoCompleteLayoutMode = exports.AutoCompleteLayoutMode || (exports.AutoCompleteLayoutMode = {}));21var AutoCompleteCompletionMode;22(function (AutoCompleteCompletionMode) {23 AutoCompleteCompletionMode["StartsWith"] = "StartsWith";24 AutoCompleteCompletionMode["Contains"] = "Contains";25})(AutoCompleteCompletionMode = exports.AutoCompleteCompletionMode || (exports.AutoCompleteCompletionMode = {}));26var AutoCompleteViewType;27(function (AutoCompleteViewType) {28 AutoCompleteViewType["ItemView"] = "ItemView";29})(AutoCompleteViewType = exports.AutoCompleteViewType || (exports.AutoCompleteViewType = {}));30// AutoComplete object classes31var SuggestionView = /** @class */ (function (_super) {32 __extends(SuggestionView, _super);33 function SuggestionView() {34 return _super.call(this) || this;35 }36 Object.defineProperty(SuggestionView.prototype, "android", {37 // properties38 get: function () {39 return undefined;40 },41 enumerable: true,42 configurable: true43 });44 Object.defineProperty(SuggestionView.prototype, "_nativeView", {45 get: function () {46 return undefined;47 },48 enumerable: true,49 configurable: true50 });51 Object.defineProperty(SuggestionView.prototype, "owner", {52 get: function () {53 return this._owner;54 },55 set: function (value) {56 this._owner = value;57 },58 enumerable: true,59 configurable: true60 });61 SuggestionView.prototype.updateView = function () {62 };63 SuggestionView.prototype.onSuggestionViewHeightPropertyChanged = function (oldValue, newValue) {64 this.onSuggestionViewHeightChanged(oldValue, newValue);65 };66 SuggestionView.prototype.onSuggestionViewHeightChanged = function (oldValue, newValue) {67 };68 SuggestionView.prototype.onSuggestionItemTemplatePropertyChanged = function (oldValue, newValue) {69 this.onSuggestionItemTemplateChanged(oldValue, newValue);70 };71 SuggestionView.prototype.onSuggestionItemTemplateChanged = function (oldValue, newValue) {72 };73 SuggestionView.suggestionViewHeightProperty = new view_1.Property({74 name: "suggestionViewHeight",75 defaultValue: undefined,76 valueConverter: function (value) {77 if (typeof value === "string") {78 return parseInt(value);79 }80 return value;81 },82 valueChanged: function (target, oldValue, newValue) {83 target.onSuggestionViewHeightPropertyChanged(oldValue, newValue);84 },85 });86 SuggestionView.suggestionItemTemplateProperty = new view_1.Property({87 name: "suggestionItemTemplate",88 defaultValue: undefined,89 valueChanged: function (target, oldValue, newValue) {90 target.onSuggestionItemTemplatePropertyChanged(oldValue, newValue);91 },92 });93 return SuggestionView;94}(view_1.View));95exports.SuggestionView = SuggestionView;96SuggestionView.suggestionViewHeightProperty.register(SuggestionView);97SuggestionView.suggestionItemTemplateProperty.register(SuggestionView);98// TokenModel99var TokenModel = /** @class */ (function () {100 function TokenModel(text, image) {101 this.text = text;102 this.image = image;103 }104 Object.defineProperty(TokenModel.prototype, "android", {105 get: function () {106 return undefined;107 },108 enumerable: true,109 configurable: true110 });111 Object.defineProperty(TokenModel.prototype, "ios", {112 get: function () {113 return undefined;114 },115 enumerable: true,116 configurable: true117 });118 return TokenModel;119}());120exports.TokenModel = TokenModel;121var CollectionViewEventData = /** @class */ (function () {122 function CollectionViewEventData() {123 }124 Object.defineProperty(CollectionViewEventData.prototype, "android", {125 get: function () {126 return this._android;127 },128 set: function (value) {129 this._android = value;130 },131 enumerable: true,132 configurable: true133 });134 Object.defineProperty(CollectionViewEventData.prototype, "ios", {135 get: function () {136 return this._ios;137 },138 set: function (value) {139 this._ios = value;140 },141 enumerable: true,142 configurable: true143 });144 Object.defineProperty(CollectionViewEventData.prototype, "eventName", {145 get: function () {146 return this._eventName;147 },148 set: function (value) {149 this._eventName = value;150 },151 enumerable: true,152 configurable: true153 });154 Object.defineProperty(CollectionViewEventData.prototype, "object", {155 get: function () {156 return this._object;157 },158 set: function (value) {159 this._object = value;160 },161 enumerable: true,162 configurable: true163 });164 Object.defineProperty(CollectionViewEventData.prototype, "index", {165 get: function () {166 return this._index;167 },168 set: function (value) {169 this._index = value;170 },171 enumerable: true,172 configurable: true173 });174 Object.defineProperty(CollectionViewEventData.prototype, "groupIndex", {175 get: function () {176 return this._groupIndex;177 },178 set: function (value) {179 this._groupIndex = value;180 },181 enumerable: true,182 configurable: true183 });184 Object.defineProperty(CollectionViewEventData.prototype, "data", {185 get: function () {186 return this._data;187 },188 set: function (value) {189 this._data = value;190 },191 enumerable: true,192 configurable: true193 });194 Object.defineProperty(CollectionViewEventData.prototype, "returnValue", {195 get: function () {196 return this._returnValue;197 },198 set: function (value) {199 this._returnValue = value;200 },201 enumerable: true,202 configurable: true203 });204 Object.defineProperty(CollectionViewEventData.prototype, "view", {205 get: function () {206 return this._view;207 },208 set: function (value) {209 this._view = value;210 },211 enumerable: true,212 configurable: true213 });214 return CollectionViewEventData;215}());216exports.CollectionViewEventData = CollectionViewEventData;217// Event object218var AutoCompleteEventData = /** @class */ (function () {219 function AutoCompleteEventData(object, eventName, text, token) {220 this._object = object;221 this._eventName = eventName;222 this._token = token;223 this._text = text;224 }225 Object.defineProperty(AutoCompleteEventData.prototype, "eventName", {226 get: function () {227 return this._eventName;228 },229 set: function (value) {230 this._eventName = value;231 },232 enumerable: true,233 configurable: true234 });235 Object.defineProperty(AutoCompleteEventData.prototype, "text", {236 get: function () {237 return this._text;238 },239 set: function (value) {240 this._text = value;241 },242 enumerable: true,243 configurable: true244 });245 Object.defineProperty(AutoCompleteEventData.prototype, "token", {246 get: function () {247 return this._token;248 },249 set: function (value) {250 this._token = value;251 },252 enumerable: true,253 configurable: true254 });255 Object.defineProperty(AutoCompleteEventData.prototype, "object", {256 get: function () {257 return this._object;258 },259 set: function (value) {260 this._object = value;261 },262 enumerable: true,263 configurable: true264 });265 return AutoCompleteEventData;266}());267exports.AutoCompleteEventData = AutoCompleteEventData;268// RadAutoComplete impl269var RadAutoCompleteTextView = /** @class */ (function (_super) {270 __extends(RadAutoCompleteTextView, _super);271 function RadAutoCompleteTextView() {272 return _super.call(this) || this;273 }274 Object.defineProperty(RadAutoCompleteTextView.prototype, "itemViewLoader", {275 // properties276 get: function () {277 return this._itemViewLoader;278 },279 set: function (value) {280 if (this._itemViewLoader !== value) {281 this._itemViewLoader = value;282 this.onItemViewLoaderChanged();283 }284 },285 enumerable: true,286 configurable: true287 });288 Object.defineProperty(RadAutoCompleteTextView.prototype, "filteredItems", {289 get: function () {290 return undefined;291 },292 enumerable: true,293 configurable: true294 });295 RadAutoCompleteTextView.prototype.onLoadSuggestionsAsyncPropertyChanged = function (oldValue, newValue) {296 this.onLoadSuggestionsAsyncChanged(oldValue, newValue);297 };298 RadAutoCompleteTextView.prototype.onLoadSuggestionsAsyncChanged = function (oldValue, newValue) {299 };300 RadAutoCompleteTextView.prototype.onItemViewLoaderChanged = function () {301 };302 RadAutoCompleteTextView.prototype.resolveTemplateView = function (template) {303 return builder.parse(template, this);304 };305 RadAutoCompleteTextView.prototype.getViewForViewType = function (viewType) {306 var newView = undefined;307 if (this._itemViewLoader !== undefined) {308 newView = this._itemViewLoader(viewType);309 }310 if (newView) {311 return newView;312 }313 var templateString = undefined;314 switch (viewType) {315 case AutoCompleteViewType.ItemView:316 if (this.suggestionView) {317 templateString = this.suggestionView.suggestionItemTemplate;318 }319 break;320 }321 return templateString === undefined ? undefined : this.resolveTemplateView(templateString);322 };323 RadAutoCompleteTextView.prototype.onItemsPropertyChanged = function (oldValue, newValue) {324 this.onItemsChanged(oldValue, newValue);325 };326 RadAutoCompleteTextView.prototype.onItemsChanged = function (oldValue, newValue) {327 };328 RadAutoCompleteTextView.prototype.onSuggestionViewPropertyChanged = function (oldValue, newValue) {329 this.onSuggestionViewChanged(oldValue, newValue);330 };331 RadAutoCompleteTextView.prototype.onSuggestionViewChanged = function (oldValue, newValue) {332 };333 RadAutoCompleteTextView.prototype.onDisplayModePropertyChanged = function (oldValue, newValue) {334 this.onDisplayModeChanged(oldValue, newValue);335 };336 RadAutoCompleteTextView.prototype.onDisplayModeChanged = function (oldValue, newValue) {337 };338 RadAutoCompleteTextView.prototype.onCompletionModePropertyChanged = function (oldValue, newValue) {339 this.onCompletionModeChanged(oldValue, newValue);340 };341 RadAutoCompleteTextView.prototype.onCompletionModeChanged = function (oldValue, newValue) {342 };343 RadAutoCompleteTextView.prototype.onLayoutModePropertyChanged = function (oldValue, newValue) {344 this.onLayoutModeChanged(oldValue, newValue);345 };346 RadAutoCompleteTextView.prototype.onLayoutModeChanged = function (oldValue, newValue) {347 };348 RadAutoCompleteTextView.prototype.onSuggestModePropertyChanged = function (oldValue, newValue) {349 this.onSuggestModeChanged(oldValue, newValue);350 };351 RadAutoCompleteTextView.prototype.onSuggestModeChanged = function (oldValue, newValue) {352 };353 RadAutoCompleteTextView.prototype.onHintPropertyChanged = function (oldValue, newValue) {354 this.onHintChanged(oldValue, newValue);355 };356 RadAutoCompleteTextView.prototype.onHintChanged = function (oldValue, newValue) {357 };358 RadAutoCompleteTextView.prototype.onTextPropertyChanged = function (oldValue, newValue) {359 this.onTextChanged(oldValue, newValue);360 };361 RadAutoCompleteTextView.prototype.onTextChanged = function (oldValue, newValue) {362 };363 RadAutoCompleteTextView.prototype.onMinimumCharactersToSearchPropertyChanged = function (oldValue, newValue) {364 this.onMinimumCharactersToSearchChanged(oldValue, newValue);365 };366 RadAutoCompleteTextView.prototype.onMinimumCharactersToSearchChanged = function (oldValue, newValue) {367 };368 RadAutoCompleteTextView.prototype.onNoResultsTextPropertyChanged = function (oldValue, newValue) {369 this.onNoResultsTextChanged(oldValue, newValue);370 };371 RadAutoCompleteTextView.prototype.onNoResultsTextChanged = function (oldValue, newValue) {372 };373 RadAutoCompleteTextView.prototype.onShowCloseButtonPropertyChanged = function (oldValue, newValue) {374 this.onShowCloseButtonChanged(oldValue, newValue);375 };376 RadAutoCompleteTextView.prototype.onShowCloseButtonChanged = function (oldValue, newValue) {377 };378 RadAutoCompleteTextView.prototype.onCloseButtonImageSrcPropertyChanged = function (oldValue, newValue) {379 this.onCloseButtonImageSrcChanged(oldValue, newValue);380 };381 RadAutoCompleteTextView.prototype.onCloseButtonImageSrcChanged = function (oldValue, newValue) {382 };383 RadAutoCompleteTextView.prototype.onReadOnlyPropertyChanged = function (oldValue, newValue) {384 this.onReadOnlyChanged(oldValue, newValue);385 };386 RadAutoCompleteTextView.prototype.onReadOnlyChanged = function (oldValue, newValue) {387 };388 // Methods389 RadAutoCompleteTextView.prototype.resetAutoComplete = function () {390 };391 RadAutoCompleteTextView.prototype.addToken = function (token) {392 };393 RadAutoCompleteTextView.prototype.insertTokenAtIndex = function (token, index) {394 };395 RadAutoCompleteTextView.prototype.removeToken = function (token) {396 };397 RadAutoCompleteTextView.prototype.removeTokenAtIndex = function (index) {398 };399 RadAutoCompleteTextView.prototype.removeAllTokens = function () {400 };401 RadAutoCompleteTextView.prototype.tokens = function () {402 };403 RadAutoCompleteTextView.prototype.tokenAtIndex = function (index) {404 };405 RadAutoCompleteTextView.textChangedEvent = "textChanged";406 RadAutoCompleteTextView.tokenRemovedEvent = "tokenRemoved";407 RadAutoCompleteTextView.tokenAddedEvent = "tokenAdded";408 RadAutoCompleteTextView.tokenSelectedEvent = "tokenSelected";409 RadAutoCompleteTextView.tokenDeselectedEvent = "tokenDeselected";410 RadAutoCompleteTextView.didAutoCompleteEvent = "didAutoComplete";411 RadAutoCompleteTextView.suggestionViewBecameVisibleEvent = "suggestionViewBecameVisible";412 RadAutoCompleteTextView.itemLoadingEvent = "itemLoading";413 RadAutoCompleteTextView.loadSuggestionsAsyncProperty = new view_1.Property({414 name: "loadSuggestionsAsync",415 defaultValue: undefined,416 valueChanged: function (target, oldValue, newValue) {417 target.onLoadSuggestionsAsyncPropertyChanged(oldValue, newValue);418 },419 });420 RadAutoCompleteTextView.itemsProperty = new view_1.Property({421 name: "items",422 defaultValue: undefined,423 valueChanged: function (target, oldValue, newValue) {424 target.onItemsPropertyChanged(oldValue, newValue);425 },426 });427 // SuggestionView428 RadAutoCompleteTextView.suggestionViewProperty = new view_1.Property({429 name: "suggestionView",430 defaultValue: undefined,431 valueChanged: function (target, oldValue, newValue) {432 target.onSuggestionViewPropertyChanged(oldValue, newValue);433 },434 });435 // Display mode436 RadAutoCompleteTextView.displayModeProperty = new view_1.Property({437 name: "displayMode",438 defaultValue: AutoCompleteDisplayMode.Plain,439 valueConverter: function (value) { return AutoCompleteDisplayMode[value]; },440 valueChanged: function (target, oldValue, newValue) {441 target.onDisplayModePropertyChanged(oldValue, newValue);442 },443 });444 // Completion Mode445 RadAutoCompleteTextView.completionModeProperty = new view_1.Property({446 name: "completionMode",447 defaultValue: AutoCompleteCompletionMode.StartsWith,448 valueConverter: function (value) { return AutoCompleteCompletionMode[value]; },449 valueChanged: function (target, oldValue, newValue) {450 target.onCompletionModePropertyChanged(oldValue, newValue);451 },452 });453 // Layout mode454 RadAutoCompleteTextView.layoutModeProperty = new view_1.Property({455 name: "layoutMode",456 defaultValue: AutoCompleteLayoutMode.Wrap,457 valueConverter: function (value) { return AutoCompleteLayoutMode[value]; },458 valueChanged: function (target, oldValue, newValue) {459 target.onLayoutModePropertyChanged(oldValue, newValue);460 },461 });462 // Suggest Mode463 RadAutoCompleteTextView.suggestModeProperty = new view_1.Property({464 name: "suggestMode",465 defaultValue: AutoCompleteSuggestMode.Suggest,466 valueConverter: function (value) { return AutoCompleteSuggestMode[value]; },467 valueChanged: function (target, oldValue, newValue) {468 target.onSuggestModePropertyChanged(oldValue, newValue);469 },470 });471 // Hint472 RadAutoCompleteTextView.hintProperty = new view_1.Property({473 name: "hint",474 defaultValue: undefined,475 valueChanged: function (target, oldValue, newValue) {476 target.onHintPropertyChanged(oldValue, newValue);477 },478 });479 // Text480 RadAutoCompleteTextView.textProperty = new view_1.Property({481 name: "text",482 defaultValue: "",483 valueChanged: function (target, oldValue, newValue) {484 target.onTextPropertyChanged(oldValue, newValue);485 },486 });487 // MinimumCharactersToSearch488 RadAutoCompleteTextView.minimumCharactersToSearchProperty = new view_1.Property({489 name: "minimumCharactersToSearch",490 defaultValue: 1,491 valueConverter: parseInt,492 valueChanged: function (target, oldValue, newValue) {493 target.onMinimumCharactersToSearchPropertyChanged(oldValue, newValue);494 },495 });496 RadAutoCompleteTextView.noResultsTextProperty = new view_1.Property({497 name: "noResultsText",498 defaultValue: undefined,499 valueChanged: function (target, oldValue, newValue) {500 target.onNoResultsTextPropertyChanged(oldValue, newValue);501 },502 });503 RadAutoCompleteTextView.showCloseButtonProperty = new view_1.Property({504 name: "showCloseButton",505 defaultValue: true,506 valueConverter: view_1.booleanConverter,507 valueChanged: function (target, oldValue, newValue) {508 target.onShowCloseButtonPropertyChanged(oldValue, newValue);509 },510 });511 RadAutoCompleteTextView.closeButtonImageSrcProperty = new view_1.Property({512 name: "closeButtonImageSrc",513 defaultValue: undefined,514 valueChanged: function (target, oldValue, newValue) {515 target.onCloseButtonImageSrcPropertyChanged(oldValue, newValue);516 },517 });518 RadAutoCompleteTextView.readOnlyProperty = new view_1.Property({519 name: "readOnly",520 defaultValue: false,521 valueConverter: view_1.booleanConverter,522 valueChanged: function (target, oldValue, newValue) {523 target.onReadOnlyPropertyChanged(oldValue, newValue);524 },525 });526 return RadAutoCompleteTextView;527}(view_1.View));528exports.RadAutoCompleteTextView = RadAutoCompleteTextView;529RadAutoCompleteTextView.loadSuggestionsAsyncProperty.register(RadAutoCompleteTextView);530RadAutoCompleteTextView.itemsProperty.register(RadAutoCompleteTextView);531RadAutoCompleteTextView.suggestionViewProperty.register(RadAutoCompleteTextView);532RadAutoCompleteTextView.displayModeProperty.register(RadAutoCompleteTextView);533RadAutoCompleteTextView.completionModeProperty.register(RadAutoCompleteTextView);534RadAutoCompleteTextView.layoutModeProperty.register(RadAutoCompleteTextView);535RadAutoCompleteTextView.suggestModeProperty.register(RadAutoCompleteTextView);536RadAutoCompleteTextView.hintProperty.register(RadAutoCompleteTextView);537RadAutoCompleteTextView.textProperty.register(RadAutoCompleteTextView);538RadAutoCompleteTextView.minimumCharactersToSearchProperty.register(RadAutoCompleteTextView);539RadAutoCompleteTextView.noResultsTextProperty.register(RadAutoCompleteTextView);540RadAutoCompleteTextView.showCloseButtonProperty.register(RadAutoCompleteTextView);541RadAutoCompleteTextView.closeButtonImageSrcProperty.register(RadAutoCompleteTextView);...

Full Screen

Full Screen

url_autocomplete_tests.js

Source:url_autocomplete_tests.js Github

copy

Full Screen

1let _ = require('lodash');2let url_pattern_matcher = require('../../src/autocomplete/url_pattern_matcher');3let autocomplete_engine = require('../../src/autocomplete/engine');4var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;5module("Url autocomplete");6function patterns_test(name, endpoints, tokenPath, expectedContext, globalUrlComponentFactories) {7 test(name, function () {8 var patternMatcher = new url_pattern_matcher.UrlPatternMatcher(globalUrlComponentFactories);9 _.each(endpoints, function (e, id) {10 e.id = id;11 _.each(e.patterns, function (p) {12 patternMatcher.addEndpoint(p, e);13 });14 });15 if (typeof tokenPath === "string") {16 if (tokenPath[tokenPath.length - 1] == "$") {17 tokenPath = tokenPath.substr(0, tokenPath.length - 1) + "/" + url_pattern_matcher.URL_PATH_END_MARKER;18 }19 tokenPath = _.map(tokenPath.split("/"), function (p) {20 p = p.split(",");21 if (p.length === 1) {22 return p[0];23 }24 return p;25 });26 }27 if (expectedContext.autoCompleteSet) {28 expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) {29 if (_.isString(t)) {30 t = {name: t}31 }32 return t;33 });34 expectedContext.autoCompleteSet = _.sortBy(expectedContext.autoCompleteSet, 'name');35 }36 var context = {};37 if (expectedContext.method) {38 context.method = expectedContext.method;39 }40 autocomplete_engine.populateContext(tokenPath, context, null,41 expectedContext.autoCompleteSet, patternMatcher.getTopLevelComponents()42 );43 // override context to just check on id44 if (context.endpoint) {45 context.endpoint = context.endpoint.id;46 }47 if (context.autoCompleteSet) {48 context.autoCompleteSet = _.sortBy(context.autoCompleteSet, 'name');49 }50 deepEqual(context, expectedContext);51 });52}53function t(name, meta) {54 if (meta) {55 return {name: name, meta: meta};56 }57 return name;58}59(function () {60 var endpoints = {61 "1": {62 patterns: [63 "a/b"64 ]65 }66 };67 patterns_test("simple single path - completion",68 endpoints,69 "a/b$",70 {endpoint: "1"}71 );72 patterns_test("simple single path - completion, with auto complete",73 endpoints,74 "a/b",75 {autoCompleteSet: []}76 );77 patterns_test("simple single path - partial, without auto complete",78 endpoints,79 "a",80 {}81 );82 patterns_test("simple single path - partial, with auto complete",83 endpoints,84 "a",85 {autoCompleteSet: ["b"]}86 );87 patterns_test("simple single path - partial, with auto complete",88 endpoints,89 [],90 {autoCompleteSet: ["a/b"]}91 );92 patterns_test("simple single path - different path",93 endpoints,94 "a/c",95 {}96 );97})();98(function () {99 var endpoints = {100 "1": {101 patterns: [102 "a/b",103 "a/b/{p}"104 ]105 },106 "2": {107 patterns: [108 "a/c"109 ]110 }111 };112 patterns_test("shared path - completion 1",113 endpoints,114 "a/b$",115 {endpoint: "1"}116 );117 patterns_test("shared path - completion 2",118 endpoints,119 "a/c$",120 {endpoint: "2"}121 );122 patterns_test("shared path - completion 1 with param",123 endpoints,124 "a/b/v$",125 {endpoint: "1", p: "v"}126 );127 patterns_test("shared path - partial, with auto complete",128 endpoints,129 "a",130 {autoCompleteSet: ["b", "c"]}131 );132 patterns_test("shared path - partial, with auto complete of param, no options",133 endpoints,134 "a/b",135 {autoCompleteSet: []}136 );137 patterns_test("shared path - partial, without auto complete",138 endpoints,139 "a",140 {}141 );142 patterns_test("shared path - different path - with auto complete",143 endpoints,144 "a/e",145 {autoCompleteSet: []}146 );147 patterns_test("shared path - different path - without auto complete",148 endpoints,149 "a/e",150 {}151 );152})();153(function () {154 var endpoints = {155 "1": {156 patterns: [157 "a/{p}",158 ],159 url_components: {160 p: ["a", "b"]161 }162 },163 "2": {164 patterns: [165 "a/c"166 ]167 }168 };169 patterns_test("option testing - completion 1",170 endpoints,171 "a/a$",172 {endpoint: "1", p: ["a"]}173 );174 patterns_test("option testing - completion 2",175 endpoints,176 "a/b$",177 {endpoint: "1", p: ["b"]}178 );179 patterns_test("option testing - completion 3",180 endpoints,181 "a/b,a$",182 {endpoint: "1", p: ["b", "a"]}183 );184 patterns_test("option testing - completion 4",185 endpoints,186 "a/c$",187 {endpoint: "2"}188 );189 patterns_test("option testing - completion 5",190 endpoints,191 "a/d$",192 {}193 );194 patterns_test("option testing - partial, with auto complete",195 endpoints,196 "a",197 {autoCompleteSet: [t("a", "p"), t("b", "p"), "c"]}198 );199 patterns_test("option testing - partial, without auto complete",200 endpoints,201 "a",202 {}203 );204 patterns_test("option testing - different path - with auto complete",205 endpoints,206 "a/e",207 {autoCompleteSet: []}208 );209})();210(function () {211 var endpoints = {212 "1": {213 patterns: [214 "a/{p}",215 ],216 url_components: {217 p: ["a", "b"]218 }219 },220 "2": {221 patterns: [222 "b/{p}",223 ]224 },225 "3": {226 patterns: [227 "b/{l}/c",228 ],229 url_components: {230 l: {231 type: "list",232 list: ["la", "lb"],233 allow_non_valid: true234 }235 }236 }237 };238 var globalFactories = {239 "p": function (name, parent) {240 return new autocomplete_engine.ListComponent(name, ["g1", "g2"], parent);241 }242 };243 patterns_test("global parameters testing - completion 1",244 endpoints,245 "a/a$",246 {endpoint: "1", p: ["a"]},247 globalFactories248 );249 patterns_test("global parameters testing - completion 2",250 endpoints,251 "b/g1$",252 {endpoint: "2", p: ["g1"]},253 globalFactories254 );255 patterns_test("global parameters testing - partial, with auto complete",256 endpoints,257 "a",258 {autoCompleteSet: [t("a", "p"), t("b", "p")]},259 globalFactories260 );261 patterns_test("global parameters testing - partial, with auto complete 2",262 endpoints,263 "b",264 {autoCompleteSet: [t("g1", "p"), t("g2", "p"), t("la", "l"), t("lb", "l")]},265 globalFactories266 );267 patterns_test("Non valid token acceptance - partial, with auto complete 1",268 endpoints,269 "b/la",270 {autoCompleteSet: ["c"], "l": ["la"]},271 globalFactories272 );273 patterns_test("Non valid token acceptance - partial, with auto complete 2",274 endpoints,275 "b/non_valid",276 {autoCompleteSet: ["c"], "l": ["non_valid"]},277 globalFactories278 );279})();280(function () {281 var endpoints = {282 "1": {283 patterns: [284 "a/b/{p}/c/e"285 ]286 }287 };288 patterns_test("look ahead - autocomplete before param 1",289 endpoints,290 "a",291 {autoCompleteSet: ["b"]}292 );293 patterns_test("look ahead - autocomplete before param 2",294 endpoints,295 [],296 {autoCompleteSet: ["a/b"]}297 );298 patterns_test("look ahead - autocomplete after param 1",299 endpoints,300 "a/b/v",301 {autoCompleteSet: ["c/e"], "p": "v"}302 );303 patterns_test("look ahead - autocomplete after param 2",304 endpoints,305 "a/b/v/c",306 {autoCompleteSet: ["e"], "p": "v"}307 );308})();309(function () {310 var endpoints = {311 "1_param": {312 patterns: [313 "a/{p}"314 ],315 methods: ["GET"]316 },317 "2_explicit": {318 patterns: [319 "a/b"320 ],321 methods: ["GET"]322 }323 };324 var e = _.cloneDeep(endpoints);325 e["1_param"].priority = 1;326 patterns_test("Competing endpoints - priority 1",327 e,328 "a/b$",329 {method: "GET", endpoint: "1_param", "p": "b"}330 );331 e = _.cloneDeep(endpoints);332 e["1_param"].priority = 1;333 e["2_explicit"].priority = 0;334 patterns_test("Competing endpoints - priority 2",335 e,336 "a/b$",337 {method: "GET", endpoint: "2_explicit"}338 );339 e = _.cloneDeep(endpoints);340 e["2_explicit"].priority = 0;341 patterns_test("Competing endpoints - priority 3",342 e,343 "a/b$",344 {method: "GET", endpoint: "2_explicit"}345 );346})();347(function () {348 var endpoints = {349 "1_GET": {350 patterns: [351 "a"352 ],353 methods: ["GET"]354 },355 "1_PUT": {356 patterns: [357 "a"358 ],359 methods: ["PUT"]360 },361 "2_GET": {362 patterns: [363 "a/b"364 ],365 methods: ["GET"]366 },367 "2_DELETE": {368 patterns: [369 "a/b"370 ],371 methods: ["DELETE"]372 }373 };374 patterns_test("Competing endpoint - sub url of another - auto complete",375 endpoints,376 "a",377 {method: "GET", autoCompleteSet: ["b"]}378 );379 patterns_test("Competing endpoint - sub url of another, complete 1",380 endpoints,381 "a$",382 {method: "GET", endpoint: "1_GET"}383 );384 patterns_test("Competing endpoint - sub url of another, complete 2",385 endpoints,386 "a$",387 {method: "PUT", endpoint: "1_PUT"}388 );389 patterns_test("Competing endpoint - sub url of another, complete 3",390 endpoints,391 "a$",392 {method: "DELETE"}393 );394 patterns_test("Competing endpoint - extension of another, complete 1, auto complete",395 endpoints,396 "a/b$",397 {method: "PUT", autoCompleteSet: []}398 );399 patterns_test("Competing endpoint - extension of another, complete 1",400 endpoints,401 "a/b$",402 {method: "GET", endpoint: "2_GET"}403 );404 patterns_test("Competing endpoint - extension of another, complete 1",405 endpoints,406 "a/b$",407 {method: "DELETE", endpoint: "2_DELETE"}408 );409 patterns_test("Competing endpoint - extension of another, complete 1",410 endpoints,411 "a/b$",412 {method: "PUT"}413 );...

Full Screen

Full Screen

autocomplete-directives.js

Source:autocomplete-directives.js Github

copy

Full Screen

1Object.defineProperty(exports, "__esModule", { value: true });2var core_1 = require("@angular/core");3var element_registry_1 = require("nativescript-angular/element-registry");4var __1 = require("./../");5var ListItemContext = /** @class */ (function (_super) {6 __extends(ListItemContext, _super);7 function ListItemContext($implicit, item, index, even, odd) {8 var _this = _super.call(this, item) || this;9 _this.$implicit = $implicit;10 _this.item = item;11 _this.index = index;12 _this.even = even;13 _this.odd = odd;14 return _this;15 }16 return ListItemContext;17}(core_1.ElementRef));18exports.ListItemContext = ListItemContext;19var NG_VIEW = "ng_view";20var RadAutoCompleteTextViewComponent = /** @class */ (function () {21 function RadAutoCompleteTextViewComponent(_elementRef, loader) {22 var _this = this;23 this._elementRef = _elementRef;24 this.loader = loader;25 this.setupItemView = new core_1.EventEmitter();26 this._autoCompleteTextView = _elementRef.nativeElement;27 var component = this;28 this._autoCompleteTextView.itemViewLoader = function (viewType) {29 switch (viewType) {30 case __1.AutoCompleteViewType.ItemView:31 if (component._itemTemplate && _this.loader) {32 var nativeItem = _this.loader.createEmbeddedView(component._itemTemplate, new ListItemContext(), 0);33 var typedView = getItemViewRoot(nativeItem);34 typedView[NG_VIEW] = nativeItem;35 return typedView;36 }37 return null;38 default:39 return null;40 }41 };42 }43 Object.defineProperty(RadAutoCompleteTextViewComponent.prototype, "nativeElement", {44 get: function () {45 return this._autoCompleteTextView;46 },47 enumerable: true,48 configurable: true49 });50 Object.defineProperty(RadAutoCompleteTextViewComponent.prototype, "autoCompleteTextView", {51 get: function () {52 return this._autoCompleteTextView;53 },54 enumerable: true,55 configurable: true56 });57 Object.defineProperty(RadAutoCompleteTextViewComponent.prototype, "itemTemplate", {58 set: function (value) {59 this._itemTemplate = value;60 },61 enumerable: true,62 configurable: true63 });64 RadAutoCompleteTextViewComponent.prototype.onItemLoading = function (args) {65 var index = args.index;66 var currentItem = args.data;67 var ngView = args.view[NG_VIEW];68 if (ngView) {69 this.setupViewRef(ngView, currentItem, index);70 this.detectChangesOnChild(ngView, index);71 }72 };73 RadAutoCompleteTextViewComponent.prototype.setupViewRef = function (viewRef, data, index) {74 var context = viewRef.context;75 context.$implicit = data;76 context.item = data;77 context.index = index;78 context.even = (index % 2 === 0);79 context.odd = !context.even;80 this.setupItemView.next({ view: viewRef, data: data, index: index, context: context });81 };82 RadAutoCompleteTextViewComponent.prototype.detectChangesOnChild = function (viewRef, index) {83 // Manually detect changes in child view ref84 // TODO: Is there a better way of getting viewRef's change detector85 var childChangeDetector = viewRef;86 childChangeDetector.markForCheck();87 childChangeDetector.detectChanges();88 };89 __decorate([90 core_1.Output(),91 __metadata("design:type", core_1.EventEmitter)92 ], RadAutoCompleteTextViewComponent.prototype, "setupItemView", void 0);93 __decorate([94 core_1.HostListener("itemLoading", ['$event']),95 __metadata("design:type", Function),96 __metadata("design:paramtypes", [__1.CollectionViewEventData]),97 __metadata("design:returntype", void 0)98 ], RadAutoCompleteTextViewComponent.prototype, "onItemLoading", null);99 RadAutoCompleteTextViewComponent = __decorate([100 core_1.Component({101 selector: "RadAutoCompleteTextView",102 template: ""103 }),104 __param(0, core_1.Inject(core_1.ElementRef)),105 __param(1, core_1.Inject(core_1.ViewContainerRef)),106 __metadata("design:paramtypes", [core_1.ElementRef,107 core_1.ViewContainerRef])108 ], RadAutoCompleteTextViewComponent);109 return RadAutoCompleteTextViewComponent;110}());111exports.RadAutoCompleteTextViewComponent = RadAutoCompleteTextViewComponent;112var TKAutoCompleteSuggestionViewDirective = /** @class */ (function () {113 function TKAutoCompleteSuggestionViewDirective(owner, _elementRef) {114 this.owner = owner;115 this._elementRef = _elementRef;116 }117 TKAutoCompleteSuggestionViewDirective.prototype.ngOnInit = function () {118 this._suggestionView = this._elementRef.nativeElement;119 this.owner.autoCompleteTextView.suggestionView = this._suggestionView;120 };121 Object.defineProperty(TKAutoCompleteSuggestionViewDirective.prototype, "nativeElement", {122 get: function () {123 return this._suggestionView;124 },125 enumerable: true,126 configurable: true127 });128 Object.defineProperty(TKAutoCompleteSuggestionViewDirective.prototype, "autoCompleteTextView", {129 get: function () {130 return this._suggestionView;131 },132 enumerable: true,133 configurable: true134 });135 TKAutoCompleteSuggestionViewDirective = __decorate([136 core_1.Directive({137 selector: "[tkAutoCompleteSuggestionView]"138 }),139 __param(0, core_1.Inject(RadAutoCompleteTextViewComponent)),140 __param(1, core_1.Inject(core_1.ElementRef)),141 __metadata("design:paramtypes", [RadAutoCompleteTextViewComponent,142 core_1.ElementRef])143 ], TKAutoCompleteSuggestionViewDirective);144 return TKAutoCompleteSuggestionViewDirective;145}());146exports.TKAutoCompleteSuggestionViewDirective = TKAutoCompleteSuggestionViewDirective;147var TKSuggestionItemTemplateDirective = /** @class */ (function () {148 function TKSuggestionItemTemplateDirective(owner, template) {149 this.owner = owner;150 this.template = template;151 }152 TKSuggestionItemTemplateDirective.prototype.ngOnInit = function () {153 this.owner.itemTemplate = this.template;154 };155 TKSuggestionItemTemplateDirective = __decorate([156 core_1.Directive({157 selector: "[tkSuggestionItemTemplate]"158 }),159 __param(0, core_1.Inject(RadAutoCompleteTextViewComponent)),160 __param(1, core_1.Inject(core_1.TemplateRef)),161 __metadata("design:paramtypes", [RadAutoCompleteTextViewComponent,162 core_1.TemplateRef])163 ], TKSuggestionItemTemplateDirective);164 return TKSuggestionItemTemplateDirective;165}());166exports.TKSuggestionItemTemplateDirective = TKSuggestionItemTemplateDirective;167function getItemViewRoot(viewRef, rootLocator) {168 if (rootLocator === void 0) { rootLocator = element_registry_1.getSingleViewRecursive; }169 var rootView = rootLocator(viewRef.rootNodes, 0);170 rootView.on("unloaded", function () {171 viewRef.destroy();172 delete rootView[NG_VIEW];173 });174 return rootView;175}176exports.AUTOCOMPLETETEXTVIEW_DIRECTIVES = [RadAutoCompleteTextViewComponent, TKAutoCompleteSuggestionViewDirective, TKSuggestionItemTemplateDirective];177if (!global.isAutoCompleteRegistered) {178 element_registry_1.registerElement("RadAutoCompleteTextView", function () { return __1.RadAutoCompleteTextView; });179 element_registry_1.registerElement("SuggestionView", function () { return __1.SuggestionView; });180 global.isAutoCompleteRegistered = true;181}182var NativeScriptUIAutoCompleteTextViewModule = /** @class */ (function () {183 function NativeScriptUIAutoCompleteTextViewModule() {184 }185 NativeScriptUIAutoCompleteTextViewModule = __decorate([186 core_1.NgModule({187 declarations: [exports.AUTOCOMPLETETEXTVIEW_DIRECTIVES],188 exports: [exports.AUTOCOMPLETETEXTVIEW_DIRECTIVES]189 })190 ], NativeScriptUIAutoCompleteTextViewModule);191 return NativeScriptUIAutoCompleteTextViewModule;192}());...

Full Screen

Full Screen

jscex-async-powerpack.min.js

Source:jscex-async-powerpack.min.js Github

copy

Full Screen

...19 h = f.Task,20 k = f.CanceledError;21 f.sleep = function (a, b) {22 return h.create(function (c) {23 b && b.isCancellationRequested && c.complete("failure", new k());24 var e, d;25 b &&26 (d = function () {27 clearTimeout(e);28 c.complete("failure", new k());29 });30 e = setTimeout(function () {31 b && b.unregister(d);32 c.complete("success");33 }, a);34 b && b.register(d);35 });36 };37 f.onEvent = function (a, b, c) {38 return h.create(function (e) {39 c && c.isCancellationRequested && e.complete("failure", new k());40 var d = function () {41 a.removeEventListener42 ? a.removeEventListener(b, g)43 : a.removeListener44 ? a.removeListener(b, g)45 : a.detachEvent(b, g);46 },47 g,48 i;49 c &&50 (i = function () {51 d();52 e.complete("failure", new k());53 });54 g = function (a) {55 c && c.unregister(i);56 d();57 e.complete("success", a);58 };59 a.addEventListener60 ? a.addEventListener(b, g)61 : a.addListener62 ? a.addListener(b, g)63 : a.attachEvent(b, g);64 c && c.register(i);65 });66 };67 h.whenAll = function () {68 var a = {},69 b;70 if (arguments.length == 1) {71 var c = arguments[0];72 h.isTask(c)73 ? ((a[0] = c), (b = !0))74 : ((a = c),75 (b = Object.prototype.toString.call(a) === "[object Array]"));76 } else {77 for (c = 0; c < arguments.length; c++) a[c] = arguments[c];78 b = !0;79 }80 return h.create(function (e) {81 var d = {},82 g;83 for (g in a)84 if (a.hasOwnProperty(g)) {85 var i = a[g];86 h.isTask(i) && (d[i.id] = g);87 }88 for (var c in d) (i = a[d[c]]), i.status == "ready" && i.start();89 for (c in d)90 if (((i = a[d[c]]), i.error)) {91 e.complete("failure", i.error);92 return;93 }94 var f = b ? [] : {},95 j = function (b) {96 if (b.error) {97 for (var c in d) a[d[c]].removeEventListener("complete", j);98 e.complete("failure", b.error);99 } else100 (f[d[b.id]] = b.result),101 delete d[b.id],102 k--,103 k == 0 && e.complete("success", f);104 },105 k = 0;106 for (c in d)107 (g = d[c]),108 (i = a[g]),109 i.status == "succeeded"110 ? ((f[g] = i.result), delete d[i.id])111 : (k++, i.addEventListener("complete", j));112 k == 0 && e.complete("success", f);113 });114 };115 h.whenAny = function () {116 var a = {};117 if (arguments.length == 1) {118 var b = arguments[0];119 h.isTask(b) ? (a[0] = b) : (a = b);120 } else for (b = 0; b < arguments.length; b++) a[b] = arguments[b];121 return h.create(function (b) {122 var e = {},123 d;124 for (d in a)125 if (a.hasOwnProperty(d)) {126 var g = a[d];127 h.isTask(g) && (e[g.id] = d);128 }129 for (var i in e) (g = a[e[i]]), g.status == "ready" && g.start();130 for (i in e)131 if (132 ((d = e[i]), (g = a[d]), g.error || g.status == "succeeded")133 ) {134 b.complete("success", { key: d, task: g });135 return;136 }137 var f = function (d) {138 for (var g in e) a[e[g]].removeEventListener("complete", f);139 b.complete("success", { key: e[d.id], task: d });140 };141 for (i in e) a[e[i]].addEventListener("complete", f);142 });143 };144 if (!f.Jscexify) f.Jscexify = {};145 f = f.Jscexify;146 f.fromStandard = function (a) {147 var b = m(arguments);148 return function () {149 var c = this,150 e = n(arguments, a.length - 1);151 return h.create(function (d) {152 e.push(function (a, c) {153 if (a) d.complete("failure", a);154 else if (b) {155 for (var e = {}, f = 0; f < b.length; f++)156 e[b[f]] = arguments[f + 1];157 return d.complete("success", e);158 } else d.complete("success", c);159 });160 a.apply(c, e);161 });162 };163 };164 f.fromCallback = function (a) {165 var b = m(arguments);166 return function () {167 var c = this,168 e = n(arguments, a.length - 1);169 return h.create(function (d) {170 e.push(function (a) {171 if (b) {172 for (var c = {}, e = 0; e < b.length; e++)173 c[b[e]] = arguments[e];174 d.complete("success", c);175 } else d.complete("success", a);176 });177 a.apply(c, e);178 });179 };180 };181 j.modules["async-powerpack"] = !0;182 }183 },184 o = typeof define === "function" && !define.amd,185 p =186 typeof require === "function" &&187 typeof define === "function" &&188 define.amd;189 if (...

Full Screen

Full Screen

todo-data.js

Source:todo-data.js Github

copy

Full Screen

1module.exports = [2 {title: 'Release Evolutility', priority: 3, category: 4, complete: false, description: '10 generic views + a ui-modeling language.', notes:''},3 {title: 'Fix open bugs', duedate: '2019-07-25', priority: 3, category: 2, complete: false, description: 'Not many are left.'},4 {title: 'Testing App', duedate: '2019-06-11', priority: 3, category: 2, complete: false, description: 'test'},5 {title: 'Prepare demo', duedate: '2019-05-12', priority: 1, category: 2, complete: false, description: 'Check this out'},6 {title: 'Test latest code', priority: 5, category: 2, complete: true, description: 'notes for my test todo task.'},7 {title: 'Car wash', priority: 5, category: 1, complete: false},8 {title: 'Watch Inception', duedate: '2019-01-10', priority: 5, category: 3, complete: true},9 {title: 'Test TODO', duedate: '2019-01-01', priority: 1, category: 4, complete: true, description: 'Test TODO '},10 {title: 'Dentist', priority: 3, category: 1, complete: true},11 {title: 'French translation', duedate: '2020-01-01', priority: 4, category: 4, complete: true, description: 'Evolutility en Français'},12 {title: 'Italian translation', duedate: '2020-01-01', priority: 4, category: 4, complete: true},13 {title: 'Chinese translation', duedate: '2020-01-01', priority: 4, category: 4, complete: false},14 {title: 'Japanese translation', duedate: '2020-01-01', priority: 4, category: 4, complete: false},15 {title: 'German translation', duedate: '2020-01-01', priority: 4, category: 4, complete: false},16 {title: 'Russian translation', duedate: '2020-01-01', priority: 4, category: 4, complete: false},17 {title: 'Klingon translation', duedate: '2020-01-01', priority: 5, category: 4, complete: false},18 {title: 'Add sample data', duedate: '2019-04-23', priority: 3, category: 4, complete: true},19 {title: 'Checkout cool restaurant near the office', priority: 3, category: 3, complete: false},20 {title: 'Code optimization', priority: 3, category: 3, complete: false},21 {title: 'GraphQL', priority: 3, category: 3, complete: false},22 {title: 'Setup demo server', priority: 2, category: 2, complete: false}, ...

Full Screen

Full Screen

App.jsx

Source:App.jsx Github

copy

Full Screen

1import React, { useState } from "react";2import ReactDOM from "react-dom";3import "./styles.css";4import { InputTodo } from "./components/InputTodo";5import { InCompleteTodo } from "./components/InCompleteTodo";6import { CompleteTodo } from "./components/CompleteTodo";7export const App = () => {8 const [todoText, setTodoText] = useState([""]);9 const [inCompleteTodos, setInCompleteTodos] = useState([]);10 const [completeTodos, setCompleteTodos] = useState([]);11 const onChangeTodoText = (event) => setTodoText(event.target.value);12 const onClickAdd = () => {13 if (todoText === "") {14 return null;15 } else {16 const newTodos = [...inCompleteTodos, todoText];17 setInCompleteTodos(newTodos);18 setTodoText("");19 }20 };21 const onClickDelete = (index) => {22 const newTodos = [...inCompleteTodos];23 newTodos.splice(index, 1);24 setInCompleteTodos(newTodos);25 };26 const onClickComplete = (index) => {27 const newInCompleteTodos = [...inCompleteTodos];28 // alert(newInCompleteTodos);29 newInCompleteTodos.splice(index, 1);30 // alert(newInCompleteTodos);31 const newCompleteTodos = [...completeTodos, inCompleteTodos[index]];32 setCompleteTodos(newCompleteTodos);33 setInCompleteTodos(newInCompleteTodos);34 };35 const onClickBack = (index) => {36 const newCompleteTodos = [...completeTodos];37 newCompleteTodos.splice(index, 1);38 const newInComplteTodos = [...inCompleteTodos, completeTodos[index]];39 setInCompleteTodos(newInComplteTodos);40 setCompleteTodos(newCompleteTodos);41 };42 return (43 <>44 <InputTodo45 todoText={todoText}46 onChange={onChangeTodoText}47 onClick={onClickAdd}48 />49 <InCompleteTodo50 inCompleteTodos={inCompleteTodos}51 onClick={onClickComplete}52 onClick2={onClickDelete}53 />54 <CompleteTodo completeTodos={completeTodos} onClick={onClickBack} />55 </>56 );...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy'),2 argosyPattern = require('argosy-pattern'),3 argosyRpc = require('argosy-rpc'),4 argosyAccept = require('argosy-accept'),5 argosyPipeline = require('argosy-pipeline'),6 argosyService = require('argosy-service'),7 argosyIdentity = require('argosy-identity'),8 argosyConsole = require('argosy-console'),9 argosyTransform = require('argosy-transform'),10 argosyLogger = require('argosy-logger'),11 argosyRouter = require('argosy-router'),12 argosyResponder = require('argosy-responder'),13 argosyRegistry = require('argosy-registry'),14 argosyServiceRegistry = require('argosy-service-registry'),15 argosyServiceLocator = require('argosy-service-locator'),16 argosyServiceRequester = require('argosy-service-requester'),17 argosyServiceRegistry = require('argosy-service-registry'),18 argosyServiceLocator = require('argosy-service-locator'),19 argosyServiceRequester = require('argosy-service-requester'),20 argosyService = require('argosy-service'),21 argosyConsole = require('argosy-console'),22 argosyPipeline = require('argosy-pipeline'),23 argosyResponder = require('argosy-responder'),24 argosyRegistry = require('argosy-registry'),25 argosyServiceRegistry = require('argosy-service-registry'),26 argosyServiceLocator = require('argosy-service-locator'),27 argosyServiceRequester = require('argosy-service-requester'),28 argosyService = require('argosy-service'),29 argosyConsole = require('argosy-console'),30 argosyPipeline = require('argosy-pipeline'),31 argosyResponder = require('argosy-responder'),32 argosyRegistry = require('argosy-registry'),33 argosyServiceRegistry = require('argosy-service-registry'),34 argosyServiceLocator = require('argosy-service-locator'),

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var argosyService = argosy()4var argosyClient = argosy()5var service = argosyService.accept({6 add: pattern.match('number', 'number', function (a, b, cb) {7 cb(null, a + b)8 })9})10service.pipe(argosyClient).pipe(service)11argosyClient({ add: pattern.value(3, 4) }, function (err, result) {12})13var argosy = require('argosy')14var pattern = require('argosy-pattern')15var argosyService = argosy()16var argosyClient = argosy()17var service = argosyService.accept({18 add: pattern.match('number', 'number', function (a, b, cb) {19 cb(null, a + b)20 })21})22service.pipe(argosyClient).pipe(service)23argosyClient({ add: pattern.value(3, 4) }, function (err, result) {24})25var argosy = require('argosy')26var pattern = require('argosy-pattern')27var argosyService = argosy()28var argosyClient = argosy()29var service = argosyService.accept({30 add: pattern.match('number', 'number', function (a, b, cb) {31 cb(null, a + b)32 })33})34service.pipe(argosyClient).pipe(service)35argosyClient({ add: pattern.value(3, 4) }, function (err, result) {36})37var argosy = require('argosy')38var pattern = require('argosy-pattern')39var argosyService = argosy()40var argosyClient = argosy()41var service = argosyService.accept({42 add: pattern.match('number', 'number', function (a, b, cb) {43 cb(null, a + b)44 })45})

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var service = argosy({3 hello: function (name, cb) {4 cb(null, `hello ${name}`)5 }6})7service.pipe(argosy.acceptor()).pipe(service)8service.hello('world', function (err, response) {9 console.log(response)10})11var argosy = require('argosy')12var service = argosy({13 hello: function (name, cb) {14 cb(null, `hello ${name}`)15 }16})17service.pipe(argosy.acceptor()).pipe(service)18service.hello('world', function (err, response) {19 console.log(response)20})21#### argosy-pattern(options, callback)22var argosy = require('argosy')23var pattern = require('argosy-pattern')24var service = argosy({25 hello: pattern({26 }, function (msg, cb) {27 cb(null, `hello ${msg.name}`)28 })29})30service.pipe(argosy.acceptor()).pipe(service)31service.hello('world', function (err, response) {32 console.log(response)33})34#### argosy-pattern-match(options, callback)35var argosy = require('argosy')36var pattern = require('argosy-pattern-match')37var service = argosy({38 hello: pattern({39 }, function (msg, cb) {40 cb(null, `hello ${msg.name}`)41 })42})43service.pipe(argosy.acceptor()).pipe(service)

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var argosyPattern = require('argosy-pattern')3var argosyService = argosy()4var servicePattern = {5 greet: complete('string -> string')6}7var service = argosyService.accept(servicePattern)8service.greet = function (name, cb) {9 cb(null, 'hello ' + name)10}11service.listen(8000)12var clientPattern = {13 greet: complete('string -> string')14}15var client = argosyService.connect(clientPattern)16client.greet('world', function (err, result) {17 console.log(result)18})19### [argosy-pattern](

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var request = require('request')4var service = argosy()5service.accept({6 'add': pattern({7 }, function (msg, cb) {8 cb(null, msg.a + msg.b)9 })10})11service.on('error', console.error)12service.listen(3000)13var client = argosy()14client.on('error', console.error)15client.connect(3000)16client.request({17 add: {18 }19}, function (err, response) {20})21var argosy = require('argosy')22var pattern = require('argosy-pattern')23var request = require('request')24var service = argosy()25service.accept({26 'add': pattern({27 }, function (msg, cb) {28 cb(null, msg.a + msg.b)29 })30})31service.on('error', console.error)32service.listen(3000)33var client = argosy()34client.on('error', console.error)35client.connect(3000)36client.request({37 add: {38 }39}, function (err, response) {40})41var argosy = require('argosy')42var pattern = require('argosy-pattern')43var request = require('request')44var service = argosy()45service.accept({46 'add': pattern({47 }, function (msg, cb) {48 cb(null, msg.a + msg.b)49 })50})51service.on('error', console.error)52service.listen(3000)53var client = argosy()54client.on('error', console.error)55client.connect(3000)56client.request({57 add: {58 }59}, function (err, response) {60})

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var service = argosy()3service.pipe(argosy.acceptor({4})).pipe(service)5service.accept({6 test: function (data, cb) {7 cb(null, 'test')8 }9}, function (err, service) {10 if (err) throw err11 service.test(function (err, data) {12 if (err) throw err13 console.log(data)14 })15})16var argosy = require('argosy')17var service = argosy()18service.pipe(argosy.acceptor({19})).pipe(service)20service.accept({21 test: function (data, cb) {22 cb(null, 'test')23 }24}, function (err, service) {25 if (err) throw err26 service.test(function (err, data) {27 if (err) throw err28 console.log(data)29 })30})31var argosy = require('argosy')32var service = argosy()33service.pipe(argosy.acceptor({34})).pipe(service)35service.accept({36 test: function (data, cb) {37 cb(null, 'test')38 }39}, function (err, service) {40 if (err) throw err41 service.test(function (err, data) {42 if (err) throw err43 console.log(data)44 })45})46var argosy = require('argosy')47var service = argosy()48service.pipe(argosy.acceptor({49})).pipe(service)50service.accept({51 test: function (data, cb) {52 cb(null, 'test')53 }54}, function (err, service) {55 if (err) throw err

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('../index')2var patterns = {3 'foo': {4 'bar': {5 'baz': {6 'qux': {7 'quux': {8 'corge': {9 'grault': {10 'garply': {11 'waldo': {12 'fred': {13 'plugh': {14 'xyzzy': {15 'thud': {16 'foo': {17 'bar': {18 'baz': {19 'qux': {20 'quux': {21 'corge': {22 'grault': {23 'garply': {24 'waldo': {25 'fred': {26 'plugh': {27 'xyzzy': {28 'thud': {29 'foo': {30 'bar': {31 'baz': {32 'qux': {33 'quux': {34 'corge': {35 'grault': {36 'garply': {37 'waldo': {38 'fred': {39 'plugh': {40 'xyzzy': {41 'thud': {42 'foo': {43 'bar': {44 'baz': {45 'qux': {46 'quux': {47 'corge': {48 'grault': {49 'garply': {50 'waldo': {51 'fred': {52 'plugh': {53 'xyzzy': {54 'thud': {55 'foo': {56 'bar': {57 'baz': {58 'qux': {59 'quux': {60 'corge': {61 'grault': {62 'garply': {63 'waldo': {64 'fred': {65 'plugh': {66 'xyzzy': {67 'thud': {68 'foo': {69 'bar': {70 'baz': {71 'qux': {72 'quux': {73 'corge': {

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var service = argosy()3service.listen(3000)4service.accept({hello: 'world'}, function (message, respond) {5 respond(null, 'hello world')6})7service.accept({name: '*'}, function (message, respond) {8 respond(null, {message: message.name})9})10service.accept({name: '*'}, function (message, respond) {11 respond(null, {message: message.name})12})13service.accept({name: '*'}, function (message, respond) {14 respond(null, {message: message.name})15})16service.accept({name: '*'}, function (message, respond) {17 respond(null, {message: message.name})18})19service.accept({name: '*'}, function (message, respond) {20 respond(null, {message: message.name})21})

Full Screen

Using AI Code Generation

copy

Full Screen

1var argosy = require('argosy')2var pattern = require('argosy-pattern')3var service = argosy()4service.accept(pattern({ foo: 'bar' }, function (msg) {5 return Promise.resolve({ foo: 'bar' })6}))7service.listen(8000)8var argosy = require('argosy')9var pattern = require('argosy-pattern')10var service = argosy()11service.accept(pattern({ foo: 'bar' }, function (msg) {12 return Promise.resolve({ foo: 'bar' })13}))14service.listen(8000)15var argosy = require('argosy')16var pattern = require('argosy-pattern')17var service = argosy()18service.accept(pattern({ foo: 'bar' }, function (msg) {19 return Promise.resolve({ foo: 'bar' })20}))21service.listen(8000)22var argosy = require('argosy')23var pattern = require('argosy-pattern')24var service = argosy()25service.accept(pattern({ foo: 'bar' }, function (msg) {26 return Promise.resolve({ foo: 'bar' })27}))28service.listen(8000)29var argosy = require('argosy

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