How to use renderTo method in storybook-root

Best JavaScript code snippet using storybook-root

bootstrapEx.js

Source:bootstrapEx.js Github

copy

Full Screen

1var bootstrapEx = {};2bootstrapEx.language = {3 Modal: {4 title: function () { return "窗口标题"; },5 closebtn: function () { return "关闭"; }6 }7};8(function ($) {9 doCallback = function (fn, args) {10 return fn.apply(this, args);11 }12 //modal弹出层13 Modal = function () {14 var _Modal = {15 renderto: "",//绘制ID16 header: null,//头元素17 body: null,//body元素18 footer: null,//footer元素19 btns: [],//按钮组20 title: bootstrapEx.language.Modal.title(),//title21 showclosebtn: true,//显示关闭按钮22 InitMax: true,//是否最大化23 firstInit: false,24 setHeigth: function (h) {25 var t = this;26 $(t.renderto).find('.modal-body').css('min-height', h);// - 110 * 227 $(window).resize(function () {28 $(t.renderto).find('.modal-body').css('min-height', h);// - 110 * 229 });30 },//设置高度31 setWidth: function (w) {32 var t = this;33 $(t.renderto).find('.modal-dialog').css('width', w);// - 200 * 234 $(window).resize(function () {35 $(t.renderto).find('.modal-dialog').css('width', w);// - 200 * 236 });37 },//设置宽度38 modal: { show: true, backdrop: 'static' },39 Init: function (isshow) {40 var t = this;41 $(t.renderto).html('');42 var body = t.body;43 t.header = null;44 t.body = null;45 t.footer = null;46 if (!$(t.renderto).hasClass('modal')) {47 $(t.renderto).addClass('modal');48 }49 if (!$(t.renderto).hasClass('fade')) {50 $(t.renderto).addClass('fade');51 }52 $(t.renderto).append('<div class="modal-dialog"><div class="modal-content"></div></div>');53 t.header = $('<div class="modal-header"></div>');54 if (t.showclosebtn) {55 $(t.header).append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>');56 }57 $(t.header).append('<div class="modal-title">' + t.title + '</div>');58 $(t.renderto).find(".modal-content").append(t.header);59 t.body = $('<div class="modal-body"></div>');60 $(t.renderto).find(".modal-content").append(t.body);61 t.body.append(body);62 t.footer = $('<div class="modal-footer"></div>');63 $(t.renderto).find(".modal-content").append(t.footer);64 t.btns.forEach(function (btn) {65 var btnclass = btn.class || "btn-primary";66 var _b = "";67 if (btn.id != "closebtn") {68 _b = $('<button class="btn" type="button" id="' + btn.id + '">' + btn.text + '</button>');69 $(_b).addClass(btnclass);70 } else {71 _b = $('<button class="btn btn-default" type="button" data-dismiss="modal" aria-hidden="true" id="' + btn.id + '">' + bootstrapEx.language.Modal.closebtn() + '</button>');72 }73 $(t.footer).append(_b);74 }, this);75 if (t.InitMax) {76 $(t.renderto).find('.modal-dialog').css('width', $(window).width() - 150 * 2);// - 200 * 277 $(t.renderto).find('.modal-body').css('min-height', $(window).height() - 110 * 2);// - 150 * 278 }79 if (isshow) {80 var moopt = { show: true, backdrop: 'static' };//keyboard81 moopt = $.extend(moopt, t.modal);82 $(t.renderto).modal(moopt);83 }84 $(t.renderto).on('shown.bs.modal', function () {85 try {86 eval(t.renderto.replace("#", "").replace(".", "") + "_Show();");87 } catch (ex) { }88 })89 $(t.renderto).on('hide.bs.modal', function () {90 try {91 eval(t.renderto.replace("#", "").replace(".", "") + "_Hide();");92 } catch (ex) { }93 })94 $(t.renderto).on('hidden.bs.modal', function () {95 try {96 eval(t.renderto.replace("#", "").replace(".", "") + "_Hideend();");97 } catch (ex) { }98 })99 t.firstInit = true;100 doCallback(t.OnfirstInited, [t]);101 },102 setTitle: function (title) {//设置标题103 var t = this;104 t.title = title;105 $(t.header).find('.modal-title').html(t.title);106 },107 toggle: function () {//设置是否显示108 var t = this;109 $(t.renderto).modal('toggle');110 },111 show: function () {//显示112 var t = this;113 if (!t.firstInit) {114 t.Init();115 }116 var moopt = { show: true, backdrop: 'static' };//keyboard117 moopt = $.extend(moopt, t.modal);118 $(t.renderto).modal(moopt);119 },120 hide: function () {//关闭121 var t = this;122 $(t.renderto).modal('hide');123 },124 OnfirstInited: function () {125 }126 }127 return _Modal;128 }129 //页签tab130 Tab = function () {131 var tabdefault = function () {132 var _tab = {133 id: "",//id134 title: "",//标题135 url: "",//地址136 isiframe: false,//是否生成ifram137 active: false,//是否激活138 iframe: null,//ifram139 iframefn: null,//返回ifram 的中的contentWindow对象 执行function 返回140 tabel: null,//页签元素141 bodyel: null,//body元素142 load: null,//load 事件触发143 showclosebtn: false144 }; return _tab;145 }146 var _tabs = {147 renderto: "",//绘制ID148 navtabs: null,149 tabcontent: null,150 tabs: [],151 fade: true,//是否显示过度效果152 firstInit: false,153 show: function (tab) {154 var tabindex;155 var t = this;156 if (!t.firstInit) {157 t.init();158 }159 if (typeof tab == "number") {160 tabindex = parseInt(tab);161 }162 else if (typeof tab == "object") {163 tabindex = t.tabs.indexOf(tab);164 }165 $(t.renderto).find('li').removeClass('active');166 $(t.renderto).find('div.tab-pane').removeClass('active');167 if ($(t.renderto).find('li').eq(tabindex).css("display") == 'none') {168 $(t.renderto).find('li').eq(tabindex).css("display", "inline");169 }170 $(t.renderto).find('li').eq(tabindex).addClass('active');171 $(t.renderto).find('div.tab-pane').eq(tabindex).addClass('active');172 if ($(t.renderto).find('div.tab-pane').eq(tabindex).hasClass('fade') && !$(t.renderto).find('div.tab-pane').eq(tabindex).hasClass('in')) {173 $(t.renderto).find('div.tab-pane').eq(tabindex).addClass('in');174 }175 if (t.tabs && t.tabs[tabindex] && t.tabs[tabindex].id) {176 eval("var fun;try{fun=" + t.tabs[tabindex].id + "_onactive;}catch(ex){}");177 if (fun) {178 fun(t);179 }180 }181 },182 hide: function (tab) {183 var tabindex;184 var t = this;185 if (typeof tab == "number") {186 tabindex = parseInt(tab);187 }188 else if (typeof tab == "object") {189 tabindex = t.tabs.indexOf(tab);190 }191 if (t.tabs.length == 1 && tabindex == 0) { return };192 $(t.renderto).find('li').eq(tabindex).css("display", "none");193 //隐藏后显示后一个,如果后一个本来就隐藏就显示再后一个194 for (var k = tabindex - 1; k >= 0 && k <= t.tabs.length - tabindex; k--) {195 if ($(t.renderto).find('li').eq(k).css("display") != 'none') {196 t.show(k);197 break;198 }199 }200 if (t.tabs && t.tabs[tabindex] && t.tabs[tabindex].id) {201 eval("var fun;try{fun=" + t.tabs[tabindex].id + "_onhide;}catch(ex){}");202 if (fun) {203 fun(t);204 }205 }206 },207 Init: function () {//绘制方法208 var t = this;209 t.navtabs = $('<ul class="nav nav-tabs"></ul>');210 t.tabcontent = $('<div class="tab-content"></div>');211 $(t.renderto).append(t.navtabs);212 $(t.renderto).append(t.tabcontent);213 var is_active = false;214 $.each(t.tabs, function (i, _tab) {215 tab = $.extend(tabdefault(), _tab);216 tab.tabel = $('<li> <a data-toggle="tab" href="#' + tab.id + '" >' + tab.title + '</a></li>');217 if (tab.showclosebtn) {218 tab.tabel = $('<li> <a data-toggle="tab" style="padding-right:25px;" href="#' + tab.id + '" >' + tab.title219 + '&nbsp;<i class="glyphicon glyphicon-remove small" tabsindex="' + i + '" id="tabclose_' + i + '" style="position: absolute;top: 14px;cursor: pointer; opacity: 0.3;" ></i></a></li>');220 }221 var bodyel = tab.bodyel;222 tab.bodyel = $('<div class="tab-pane" id="' + tab.id + '"></div>');223 if (tab.isiframe) {224 tab.iframe = $('<iframe id="' + tab.id + '_iframe" width="100%" height="100%" src="' + tab.url + '" frameborder="0"></iframe>');225 $(tab.bodyel).append(tab.iframe);226 }227 if (t.fade) {228 $(tab.bodyel).addClass("fade");229 $(tab.bodyel).addClass("in");230 }231 if (!is_active && tab.active) {232 is_active = true;233 $(tab.tabel).addClass("active");234 $(tab.bodyel).addClass("active");235 }236 $(t.navtabs).append(tab.tabel);237 $(t.tabcontent).append(tab.bodyel);238 tab.bodyel.append(bodyel);239 t.tabs[i] = tab;240 if (document.getElementById(tab.id + '_iframe') && document.getElementById(tab.id + '_iframe').contentWindow) {241 tab.iframefn = document.getElementById(tab.id + '_iframe').contentWindow;242 }243 tab.iframe = $('#' + tab.id + '_iframe');244 var load;245 if (tab.load) {246 load = tab.load;247 $('#' + tab.id + '_iframe').load(function () {248 load(this);249 });250 }251 })252 //$(t.renderto).find('.tab-pane').css('min-height', $(t.renderto).height());253 setTimeout(function () {254 $(t.renderto).find('.tab-pane').find('iframe').css('min-height', $(window).height() - 140 * 2);255 }, 200);256 $(t.navtabs).find('[tabsindex]').on('click', function () {257 t.hide(parseInt($(this).attr('tabsindex')));258 return false;259 })260 t.firstInit = true;261 doCallback(t.OnfirstInited, [t]);262 },263 isactive: function (tab) {264 var tabindex;265 var t = this;266 if (typeof tab == "number") {267 tabindex = parseInt(tab);268 }269 else if (typeof tab == "object") {270 tabindex = t.tabs.indexOf(tab);271 }272 if (tabindex == 0) { return };273 return $(t.renderto).find('li').eq(tabindex).css("display") != 'none';274 },275 OnfirstInited: function () {276 }277 };278 return _tabs;279 }280 getNowDateInt = function () {281 var date = new Date();282 var seperator1 = "-";283 var seperator2 = ":";284 var month = date.getMonth() + 1;285 var strDate = date.getDate();286 if (month >= 1 && month <= 9) {287 month = "0" + month;288 }289 if (strDate >= 0 && strDate <= 9) {290 strDate = "0" + strDate;291 }292 var currentdate = date.getFullYear() + month + strDate293 + date.getHours() + date.getMinutes()294 + date.getSeconds();295 return currentdate;296 }...

Full Screen

Full Screen

editors.js

Source:editors.js Github

copy

Full Screen

1/*2* editors3* author: ronglin4* create date: 2011.12.285*/6/*7* config parameters:8* renderTo, host9*/10(function ($, ctx) {11 // localization12 var txtRes = {13 title: 'Editors',14 fontGroup: 'Font properties',15 textGroup: 'Text properties',16 boxGroup: 'Box properties',17 positioningGroup: 'Positioning properties',18 backgroundGroup: 'Background properties'19 };20 // localize text resource21 if (window.__localization) { $.extend(txtRes, __localization.editors_js); }22 // helpers23 var markSelf = function (obj) {24 obj['editors_js'] = true; return obj;25 }, isSelf = function (obj) {26 return (obj['editors_js'] === true);27 };28 /*29 * editorsClass30 */31 var editorsClass = function (config) {32 $.extend(this, config);33 //this.initialize();34 };35 editorsClass.prototype = {36 renderTo: null, host: null, el: null,37 currentRule: null, itemEditors: null,38 _onload: null, _onpropertychange: null,39 constructor: editorsClass,40 initialize: function () {41 var self = this;42 this.itemEditors = {};43 this.el = $(this.bulidHtml()).appendTo(this.renderTo);44 // dom events45 var groupHeads = this.el.find('.content .group .head');46 groupHeads.click(function () {47 if ($(this).hasClass('select')) { return; }48 groupHeads.each(function ()49 { $(this).next().slideUp('fast'); });50 $(this).next().slideDown('fast');51 groupHeads.removeClass('select');52 $(this).addClass('select');53 }).hover(function () {54 $(this).addClass('hover');55 }, function () {56 $(this).removeClass('hover');57 });58 // subscribe host events59 this._onload = function () { self.clean(); };60 this._onpropertychange = function (sender, set) {61 if (isSelf(set)) { return; }62 self.updateRule(self.currentRule);63 };64 this._onselect = function (sender, set) {65 if (isSelf(set)) { return; }66 self.removeRuleSubscribe();67 self.updateRule(set.rule);68 self.currentRule.onPropertySort.add(self._onpropertychange);69 self.currentRule.onPropertyChange.add(self._onpropertychange);70 };71 this.host.onLoad.add(this._onload);72 this.host.onSelect.add(this._onselect);73 // register editors74 this.registerComponents(this.itemEditors);75 },76 bulidHtml: function () {77 var html = [];78 html.push('<div class="vs-editors">');79 html.push('<h3>' + txtRes.title + '</h3>');80 html.push('<div class="content">');81 html.push('<div class="group"><div class="head">' + txtRes.fontGroup + '</div><div class="body"></div></div>');82 html.push('<div class="group"><div class="head">' + txtRes.textGroup + '</div><div class="body"></div></div>');83 html.push('<div class="group"><div class="head">' + txtRes.boxGroup + '</div><div class="body"></div></div>');84 html.push('<div class="group"><div class="head">' + txtRes.positioningGroup + '</div><div class="body"></div></div>');85 html.push('<div class="group"><div class="head">' + txtRes.backgroundGroup + '</div><div class="body"></div></div>');86 html.push('</div>');87 html.push('</div>');88 return html.join('');89 },90 registerComponents: function (holder) {91 var bodys = this.el.find('.content .group .body');92 // Font properties93 var group0 = bodys.eq(0);94 holder['font-family'] = new ctx.editors.textClass({ host: this, renderTo: group0, title: 'Font-family', name: 'font-family' });95 holder['font-size'] = new ctx.editors.unitClass({ host: this, renderTo: group0, title: 'Font-size', name: 'font-size', units: ctx.cssLengthUnits });96 holder['font-weight'] = new ctx.editors.comboClass({ host: this, renderTo: group0, title: 'Font-weight', name: 'font-weight', items: ctx.propertySet['font-weight'] });97 holder['line-height'] = new ctx.editors.unitClass({ host: this, renderTo: group0, title: 'Line-height', name: 'line-height', units: ctx.cssLengthUnits });98 holder['font-variant'] = new ctx.editors.comboClass({ host: this, renderTo: group0, title: 'Font-variant', name: 'font-variant', items: ctx.propertySet['font-variant'] });99 holder['letter-spacing'] = new ctx.editors.unitClass({ host: this, renderTo: group0, title: 'Letter-spacing', name: 'letter-spacing', units: ctx.cssLengthUnits });100 holder['font-style'] = new ctx.editors.comboClass({ host: this, renderTo: group0, title: 'Font-style', name: 'font-style', items: ctx.propertySet['font-style'] });101 holder['color'] = new ctx.editors.colorClass({ host: this, renderTo: group0, title: 'Color', name: 'color' });102 // Text properties103 var group1 = bodys.eq(1);104 holder['text-align'] = new ctx.editors.comboClass({ host: this, renderTo: group1, title: 'Text-align', name: 'text-align', items: ctx.propertySet['text-align'] });105 holder['text-decoration'] = new ctx.editors.comboClass({ host: this, renderTo: group1, title: 'Text-decoration', name: 'text-decoration', items: ctx.propertySet['text-decoration'] });106 holder['text-transform'] = new ctx.editors.comboClass({ host: this, renderTo: group1, title: 'Text-transform', name: 'text-transform', items: ctx.propertySet['text-transform'] });107 holder['text-indent'] = new ctx.editors.unitClass({ host: this, renderTo: group1, title: 'Text-indent', name: 'text-indent', units: ctx.cssLengthUnits });108 holder['word-wrap'] = new ctx.editors.comboClass({ host: this, renderTo: group1, title: 'Word-wrap', name: 'word-wrap', items: ctx.propertySet['word-wrap'] });109 // Box properties110 var group2 = bodys.eq(2);111 holder['width'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Width', name: 'width', units: ctx.cssLengthUnits });112 holder['height'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Height', name: 'height', units: ctx.cssLengthUnits });113 holder['left'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Left', name: 'left', units: ctx.cssLengthUnits });114 holder['top'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Top', name: 'top', units: ctx.cssLengthUnits });115 holder['right'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Right', name: 'right', units: ctx.cssLengthUnits });116 holder['bottom'] = new ctx.editors.unitClass({ host: this, renderTo: group2, title: 'Bottom', name: 'bottom', units: ctx.cssLengthUnits });117 holder['border'] = new ctx.editors.textClass({ host: this, renderTo: group2, title: 'Border', name: 'border' });118 holder['margin'] = new ctx.editors.textClass({ host: this, renderTo: group2, title: 'Margin', name: 'margin' });119 holder['padding'] = new ctx.editors.textClass({ host: this, renderTo: group2, title: 'Padding', name: 'padding' });120 // Positioning properties121 var group3 = bodys.eq(3);122 holder['display'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Display', name: 'display', items: ctx.propertySet['display'] });123 holder['float'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Float', name: 'float', items: ctx.propertySet['float'] });124 holder['overflow'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Overflow', name: 'overflow', items: ctx.propertySet['overflow'] });125 holder['position'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Position', name: 'position', items: ctx.propertySet['position'] });126 holder['opacity'] = new ctx.editors.numberClass({ host: this, renderTo: group3, title: 'Opacity', name: 'opacity' });127 holder['visibility'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Visibility', name: 'visibility', items: ctx.propertySet['visibility'] });128 holder['clear'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Clear', name: 'clear', items: ctx.propertySet['clear'] });129 holder['cursor'] = new ctx.editors.comboClass({ host: this, renderTo: group3, title: 'Cursor', name: 'cursor', items: ctx.propertySet['cursor'] });130 holder['z-index'] = new ctx.editors.numberClass({ host: this, renderTo: group3, title: 'Z-index', name: 'z-index' });131 // Background properties132 var group4 = bodys.eq(4);133 holder['background-color'] = new ctx.editors.colorClass({ host: this, renderTo: group4, title: 'Bg-color', name: 'background-color' });134 holder['background-image'] = new ctx.editors.fileClass({ host: this, renderTo: group4, title: 'Image', name: 'background-image' });135 holder['background-repeat'] = new ctx.editors.comboClass({ host: this, renderTo: group4, title: 'Repeat', name: 'background-repeat', items: ctx.propertySet['background-repeat'] });136 holder['background-attachment'] = new ctx.editors.comboClass({ host: this, renderTo: group4, title: 'Attachment', name: 'background-attachment', items: ctx.propertySet['background-attachment'] });137 holder['background-position'] = new ctx.editors.comboClass({ host: this, renderTo: group4, title: 'Position', name: 'background-position', items: ctx.propertySet['background-position'] });138 },139 updateRule: function (rule) {140 this.clean();141 this.currentRule = rule;142 var items = rule.getProperties(), self = this;143 $.each(items, function () {144 var editor = self.itemEditors[ctx.nospace(this.getName())];145 if (editor) { editor.assignProperty(this); }146 });147 },148 syncProperty: function (set) {149 if (this.currentRule) {150 set = set || {};151 return this.currentRule.setProperty(markSelf(set));152 }153 },154 firePreview: function (set) {155 if (this.currentRule) {156 set = set || {};157 this.currentRule.onPreview.dispatch(this, markSelf(set));158 }159 },160 firePreviewEnd: function (set) {161 if (this.currentRule) {162 set = set || {};163 this.currentRule.onPreviewEnd.dispatch(this, markSelf(set));164 }165 },166 clean: function () {167 $.each(this.itemEditors, function () { this.clean(); });168 this.currentRule = null;169 },170 removeRuleSubscribe: function () {171 if (this.currentRule) {172 this.currentRule.onPropertySort.add(this._onpropertychange);173 this.currentRule.onPropertyChange.remove(this._onpropertychange);174 }175 },176 remove: function () {177 this.removeRuleSubscribe();178 this.host.onLoad.remove(this._onload);179 this.host.onSelect.remove(this._onselect);180 $.each(this.itemEditors, function () { this.remove(); });181 this.el.remove();182 this.host = null;183 }184 };185 // register186 ctx.editorsClass = editorsClass;...

Full Screen

Full Screen

renderer.js

Source:renderer.js Github

copy

Full Screen

1/**2 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation3 * 4 * Published under the BSD license.5 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text6 * of the license.7 */8/** api: example[renderer]9 * Feature Renderer10 * ----------------11 * Render a vector feature with multiple symbolizers in a box component.12 */13var blue = {14 fillColor: "blue",15 fillOpacity: 0.25,16 strokeColor: "blue",17 strokeWidth: 2,18 pointRadius: 519};20var custom = {21 point: {22 graphicName: "star",23 pointRadius: 8,24 fillColor: "yellow",25 strokeColor: "red",26 strokeWidth: 127 },28 line: {29 strokeColor: "#669900",30 strokeWidth: 331 },32 poly: {33 fillColor: "olive",34 fillOpacity: 0.25,35 strokeColor: "#666666",36 strokeWidth: 2,37 strokeDashstyle: "dot"38 }39};40var stacked = {41 point: [{42 pointRadius: 8,43 fillColor: "white",44 strokeColor: "red",45 strokeWidth: 246 }, {47 graphicName: "star",48 pointRadius: 5,49 fillColor: "red"50 }],51 line: [{52 strokeColor: "red",53 strokeWidth: 554 }, {55 strokeColor: "#ff9933",56 strokeWidth: 257 }],58 poly: [{59 strokeWidth: 3,60 fillColor: "white",61 strokeColor: "#669900"62 }, {63 strokeWidth: 2,64 fillOpacity: 0,65 strokeColor: "red",66 strokeDashstyle: "dot"67 }]68};69var configs = [{70 symbolType: "Point",71 renderTo: "point_default"72}, {73 symbolType: "Line",74 renderTo: "line_default"75}, {76 symbolType: "Polygon",77 renderTo: "poly_default"78}, {79 symbolType: "Point",80 symbolizers: [blue],81 renderTo: "point_blue"82}, {83 symbolType: "Line",84 symbolizers: [blue],85 renderTo: "line_blue"86}, {87 symbolType: "Polygon",88 symbolizers: [blue],89 renderTo: "poly_blue"90}, {91 symbolType: "Point",92 symbolizers: [custom.point],93 renderTo: "point_custom"94}, {95 symbolType: "Line",96 symbolizers: [custom.line],97 renderTo: "line_custom"98}, {99 symbolType: "Polygon",100 symbolizers: [custom.poly],101 renderTo: "poly_custom"102}, {103 symbolType: "Point",104 symbolizers: stacked.point,105 renderTo: "point_stacked"106}, {107 symbolType: "Line",108 symbolizers: stacked.line,109 renderTo: "line_stacked"110}, {111 symbolType: "Polygon",112 symbolizers: stacked.poly,113 renderTo: "poly_stacked"114}];115Ext.onReady(function() { 116 for(var i=0; i<configs.length; ++i) {117 new GeoExt.FeatureRenderer(configs[i]);118 }119 $("render").onclick = render;120});121var format = new OpenLayers.Format.WKT();122var renderer, win;123function render() {124 var wkt = $("wkt").value;125 var feature;126 try {127 feature = format.read(wkt)128 } catch(err) {129 $("wkt").value = "Bad WKT: " + err;130 }131 var symbolizers;132 try {133 var value = $("symbolizers").value;134 symbolizers = eval("(" + value + ")");135 if (!symbolizers || symbolizers.constructor !== Array) {136 throw "Must be an array literal";137 }138 } catch(err) {139 $("symbolizers").value = "Bad symbolizers: " + err + "\n\n" + value;140 symbolizers = null;141 }142 if(feature && symbolizers) {143 if(!win) {144 renderer = new GeoExt.FeatureRenderer({145 feature: feature,146 symbolizers: symbolizers,147 width: 150,148 style: {margin: 4}149 });150 win = new Ext.Window({151 closeAction: "hide",152 layout: "fit",153 width: 175,154 items: [renderer]155 });156 } else {157 renderer.update({158 feature: feature,159 symbolizers: symbolizers160 });161 }162 win.show();163 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { renderTo } = require('storybook-root-decorator')2const { render } = require('react-dom')3const { renderTo } = require('storybook-root-decorator')4const { render } = require('react-dom')5const { renderTo } = require('storybook-root-decorator')6const { render } = require('react-dom')7const { renderTo } = require('storybook-root-decorator')8const { render } = require('react-dom')9const { renderTo } = require('storybook-root-decorator')10const { render } = require('react-dom')11const { renderTo } = require('storybook-root-decorator')12const { render } = require('react-dom')13const { renderTo } = require('storybook-root-decorator')14const { render } = require('react-dom')15const { renderTo } = require('storybook-root-decorator')16const { render } = require('react-dom')17const { renderTo } = require('storybook-root-decorator')18const { render } = require('react-dom')19const { renderTo } = require('storybook-root-decorator')20const { render } = require('react-dom')21const { renderTo } = require('storybook-root-decorator')22const { render } = require('react-dom')23const { renderTo } = require('storybook-root-decorator')24const { render } = require('react-dom')25const { renderTo } = require('storybook-root-decorator')26const { render } = require('react-dom')

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { renderTo } from 'storybook-root-decorator';3storiesOf('MyComponent', module)4 .add('with text', () => (5 renderTo(<MyComponent />, { style: { color: 'red' } })6 ));7const MyComponent = ({ style }) => (8 <div style={style}>Hello World!</div>9);10import React from 'react';11import { render } from 'react-dom';12export const renderTo = (component, props) => {13 const div = document.createElement('div');14 render(React.cloneElement(component, props), div);15 return div;16};17module.exports = {18 require.resolve('./test.js'),19};20import React from 'react';21import { shallow } from 'enzyme';22import MyComponent from '../MyComponent';23describe('MyComponent', () => {24 it('renders with text', () => {25 const wrapper = shallow(<MyComponent />);26 expect(wrapper.text()).toEqual('Hello World!');27 });28});29import 'jest-dom/extend-expect';30import React from 'react';31import { render } from 'react-dom';32export const renderTo = (component, props) => {33 const div = document.createElement('div');34 render(React.cloneElement(component, props), div);35 return div;36};37module.exports = {38 require.resolve('./test.js'),39};40import { renderTo } from 'storybook-root-decorator';41import { addDecorator } from '@storybook/react';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderTo } from 'storybook-root';2import { MyComponent } from 'my-component';3renderTo('MyComponent', MyComponent);4import { registerElement } from 'lwc';5import StorybookRoot from 'storybook-root';6registerElement('storybook-root', StorybookRoot);7import 'storybook-root.js';8import './test.js';9### `registerElement(tagName, Constructor)`10### `renderTo(tagName, Constructor, props)`11### `registerComponent(tagName, Constructor, props)`12### `renderToStorybook(tagName, Constructor, props)`

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderTo } from 'storybook-root';2import React from 'react';3import { MyComponent } from './MyComponent';4renderTo('MyComponent', <MyComponent />);5import '../test';6import 'storybook-root/register';7module.exports = (storybookBaseConfig, configType) => {8 const storybookConfig = storybookBaseConfig;9 storybookConfig.entry.preview.push('storybook-root/register');10 return storybookConfig;11};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderTo } from 'storybook-root'2import MyComponent from './MyComponent'3const component = renderTo(MyComponent, { data: { text: 'Hello World' } })4import { renderTo } from 'storybook-root'5import MyComponent from './MyComponent'6const component = renderTo(MyComponent, { data: { text: 'Hello World' } })7import { renderTo } from 'storybook-root'8import MyComponent from './MyComponent'9const component = renderTo(MyComponent, { data: { text: 'Hello World' } })10import { renderTo } from 'storybook-root'11import MyComponent from './MyComponent'12const component = renderTo(MyComponent, { data: { text: 'Hello World' } })13import { renderTo } from 'storybook-root'14import MyComponent from './MyComponent'15const component = renderTo(MyComponent, { data: { text: 'Hello World' } })16import { renderTo } from 'storybook-root'17import MyComponent from './MyComponent'18const component = renderTo(MyComponent, { data: { text: 'Hello World' } })19import { renderTo } from 'storybook-root'20import MyComponent from './MyComponent'21const component = renderTo(MyComponent, { data: { text: 'Hello World' } })22import { renderTo } from 'storybook-root'23import MyComponent from './MyComponent'24const component = renderTo(MyComponent,

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storybookRoot } from 'storybook-root';2storybookRoot.renderTo('storybook-root');3import { storybookRoot } from 'storybook-root';4storybookRoot.renderTo('storybook-root');5import { storybookRoot } from 'storybook-root';6storybookRoot.renderTo('storybook-root');7import { storybookRoot } from 'storybook-root';8storybookRoot.renderTo('storybook-root');9import { storybookRoot } from 'storybook-root';10storybookRoot.renderTo('storybook-root');11import { storybookRoot } from 'storybook-root';

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful