Best JavaScript code snippet using ng-mocks
tests.js
Source:tests.js
...46 loadstop: logEvent,47 exit: logEvent48 };49 if (useWindowOpen) {50 console.log('Use window.open() for url');51 iab = window.open(url, target, params, callbacks);52 }53 else {54 iab = cordova.InAppBrowser.open(url, target, params, callbacks);55 }56 if (!iab) {57 alert('open returned ' + iab);58 return;59 }60 function logEvent(e) {61 console.log('IAB event=' + JSON.stringify(e));62 counts[e.type]++;63 // Verify that event.url gets updated on redirects.64 if (e.type == 'loadstart') {65 if (e.url == lastLoadStartURL) {66 alert('Unexpected: loadstart fired multiple times for the same URL.');67 }68 lastLoadStartURL = e.url;69 }70 // Verify the right number of loadstart events were fired.71 if (e.type == 'loadstop' || e.type == 'loaderror') {72 if (e.url != lastLoadStartURL) {73 alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url');74 }75 if (numExpectedRedirects === 0 && counts['loadstart'] !== 1) {76 // Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL).77 if (!(e.type == 'loaderror' && counts['loadstart'] === 0)) {78 alert('Unexpected: got multiple loadstart events. (' + counts['loadstart'] + ')');79 }80 } else if (numExpectedRedirects > 0 && counts['loadstart'] < (numExpectedRedirects + 1)) {81 alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts['loadstart']);82 }83 wasReset = true;84 numExpectedRedirects = 0;85 reset();86 }87 // Verify that loadend / loaderror was called.88 if (e.type == 'exit') {89 var numStopEvents = counts['loadstop'] + counts['loaderror'];90 if (numStopEvents === 0 && !wasReset) {91 alert('Unexpected: browser closed without a loadstop or loaderror.');92 } else if (numStopEvents > 1) {93 alert('Unexpected: got multiple loadstop/loaderror events.');94 }95 }96 }97 return iab;98 }99 function doHookOpen(url, target, params, numExpectedRedirects) {100 var originalFunc = window.open;101 var wasClobbered = window.hasOwnProperty('open');102 window.open = cordova.InAppBrowser.open;103 try {104 doOpen(url, target, params, numExpectedRedirects, true);105 }106 finally {107 if (wasClobbered) {108 window.open = originalFunc;109 }110 else {111 console.log('just delete, to restore open from prototype');112 delete window.open;113 }114 }115 }116 function openWithStyle(url, cssUrl, useCallback) {117 var iab = doOpen(url, '_blank', 'location=yes');118 var callback = function (results) {119 if (results && results.length === 0) {120 alert('Results verified');121 } else {122 console.log(results);123 alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));124 }125 };126 if (cssUrl) {127 iab.addEventListener('loadstop', function (event) {128 iab.insertCSS({ file: cssUrl }, useCallback && callback);129 });130 } else {131 iab.addEventListener('loadstop', function (event) {132 iab.insertCSS({ code: '#style-update-literal { \ndisplay: block !important; \n}' },133 useCallback && callback);134 });135 }136 }137 function openWithScript(url, jsUrl, useCallback) {138 var iab = doOpen(url, '_blank', 'location=yes');139 if (jsUrl) {140 iab.addEventListener('loadstop', function (event) {141 iab.executeScript({ file: jsUrl }, useCallback && function (results) {142 if (results && results.length === 0) {143 alert('Results verified');144 } else {145 console.log(results);146 alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));147 }148 });149 });150 } else {151 iab.addEventListener('loadstop', function (event) {152 var code = '(function(){\n' +153 ' var header = document.getElementById("header");\n' +154 ' header.innerHTML = "Script literal successfully injected";\n' +155 ' return "abc";\n' +156 '})()';157 iab.executeScript({ code: code }, useCallback && function (results) {158 if (results && results.length === 1 && results[0] === 'abc') {159 alert('Results verified');160 } else {161 console.log(results);162 alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));163 }164 });165 });166 }167 }168 var hiddenwnd = null;169 var loadlistener = function (event) { alert('background window loaded '); };170 function openHidden(url, startHidden) {171 var shopt = (startHidden) ? 'hidden=yes' : '';172 hiddenwnd = cordova.InAppBrowser.open(url, 'random_string', shopt);173 if (!hiddenwnd) {174 alert('cordova.InAppBrowser.open returned ' + hiddenwnd);175 return;176 }177 if (startHidden) hiddenwnd.addEventListener('loadstop', loadlistener);178 }179 function showHidden() {180 if (!!hiddenwnd) {181 hiddenwnd.show();182 }183 }184 function closeHidden() {185 if (!!hiddenwnd) {186 hiddenwnd.removeEventListener('loadstop', loadlistener);187 hiddenwnd.close();188 hiddenwnd = null;189 }190 }191 var info_div = '<h1>InAppBrowser</h1>' +192 '<div id="info">' +193 'Make sure http://cordova.apache.org and http://google.co.uk and https://www.google.co.uk are white listed. </br>' +194 'Make sure http://www.apple.com is not in the white list.</br>' +195 'In iOS, starred <span style="vertical-align:super">*</span> tests will put the app in a state with no way to return. </br>' +196 '<h4>User-Agent: <span id="user-agent"> </span></hr>' +197 '</div>';198 var local_tests = '<h1>Local URL</h1>' +199 '<div id="openLocal"></div>' +200 'Expected result: opens successfully in CordovaWebView.' +201 '<p/> <div id="openLocalHook"></div>' +202 'Expected result: opens successfully in CordovaWebView (using hook of window.open()).' +203 '<p/> <div id="openLocalSelf"></div>' +204 'Expected result: opens successfully in CordovaWebView.' +205 '<p/> <div id="openLocalSystem"></div>' +206 'Expected result: fails to open' +207 '<p/> <div id="openLocalBlank"></div>' +208 'Expected result: opens successfully in InAppBrowser with locationBar at top.' +209 '<p/> <div id="openLocalRandomNoLocation"></div>' +210 'Expected result: opens successfully in InAppBrowser without locationBar.' +211 '<p/> <div id="openLocalRandomToolBarBottom"></div>' +212 'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the bottom.' +213 '<p/> <div id="openLocalRandomToolBarTop"></div>' +214 'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the top.' +215 '<p/><div id="openLocalRandomToolBarTopNoLocation"></div>' +216 'Expected result: open successfully in InAppBrowser with no locationBar. On iOS the toolbar is at the top.';217 var white_listed_tests = '<h1>White Listed URL</h1>' +218 '<div id="openWhiteListed"></div>' +219 'Expected result: open successfully in CordovaWebView to cordova.apache.org' +220 '<p/> <div id="openWhiteListedHook"></div>' +221 'Expected result: open successfully in CordovaWebView to cordova.apache.org (using hook of window.open())' +222 '<p/> <div id="openWhiteListedSelf"></div>' +223 'Expected result: open successfully in CordovaWebView to cordova.apache.org' +224 '<p/> <div id="openWhiteListedSystem"></div>' +225 'Expected result: open successfully in system browser to cordova.apache.org' +226 '<p/> <div id="openWhiteListedBlank"></div>' +227 'Expected result: open successfully in InAppBrowser to cordova.apache.org' +228 '<p/> <div id="openWhiteListedRandom"></div>' +229 'Expected result: open successfully in InAppBrowser to cordova.apache.org' +230 '<p/> <div id="openWhiteListedRandomNoLocation"></div>' +231 'Expected result: open successfully in InAppBrowser to cordova.apache.org with no location bar.';232 var non_white_listed_tests = '<h1>Non White Listed URL</h1>' +233 '<div id="openNonWhiteListed"></div>' +234 'Expected result: open successfully in InAppBrowser to apple.com.' +235 '<p/> <div id="openNonWhiteListedHook"></div>' +236 'Expected result: open successfully in InAppBrowser to apple.com (using hook of window.open()).' +237 '<p/> <div id="openNonWhiteListedSelf"></div>' +238 'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' +239 '<p/> <div id="openNonWhiteListedSystem"></div>' +240 'Expected result: open successfully in system browser to apple.com.' +241 '<p/> <div id="openNonWhiteListedBlank"></div>' +242 'Expected result: open successfully in InAppBrowser to apple.com.' +243 '<p/> <div id="openNonWhiteListedRandom"></div>' +244 'Expected result: open successfully in InAppBrowser to apple.com.' +245 '<p/> <div id="openNonWhiteListedRandomNoLocation"></div>' +246 'Expected result: open successfully in InAppBrowser to apple.com without locationBar.';247 var page_with_redirects_tests = '<h1>Page with redirect</h1>' +248 '<div id="openRedirect301"></div>' +249 'Expected result: should 301 and open successfully in InAppBrowser to https://www.google.co.uk.' +250 '<p/> <div id="openRedirect302"></div>' +...
OpenLayers.js
Source:OpenLayers.js
1/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for 2 * full list of contributors). Published under the Clear BSD license. 3 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the4 * full text of the license. */5/* 6 * @requires OpenLayers/BaseTypes.js7 * @requires OpenLayers/Lang/en.js8 * @requires OpenLayers/Console.js9 */10 11/*12 * TODO: In 3.0, we will stop supporting build profiles that include13 * OpenLayers.js. This means we will not need the singleFile and scriptFile14 * variables, because we don't have to handle the singleFile case any more.15 */16(function() {17 /**18 * Before creating the OpenLayers namespace, check to see if19 * OpenLayers.singleFile is true. This occurs if the20 * OpenLayers/SingleFile.js script is included before this one - as is the21 * case with old single file build profiles that included both22 * OpenLayers.js and OpenLayers/SingleFile.js.23 */24 var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);25 26 /**27 * Relative path of this script.28 */29 var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";30 /*31 * If window.OpenLayers isn't set when this script (OpenLayers.js) is32 * evaluated (and if singleFile is false) then this script will load33 * *all* OpenLayers scripts. If window.OpenLayers is set to an array34 * then this script will attempt to load scripts for each string of35 * the array, using the string as the src of the script.36 *37 * Example:38 * (code)39 * <script type="text/javascript">40 * window.OpenLayers = [41 * "OpenLayers/Util.js",42 * "OpenLayers/BaseTypes.js"43 * ];44 * </script>45 * <script type="text/javascript" src="../lib/OpenLayers.js"></script>46 * (end)47 * In this example OpenLayers.js will load Util.js and BaseTypes.js only.48 */49 var jsFiles = window.OpenLayers;50 /**51 * Namespace: OpenLayers52 * The OpenLayers object provides a namespace for all things OpenLayers53 */54 window.OpenLayers = {55 /**56 * Method: _getScriptLocation57 * Return the path to this script. This is also implemented in58 * OpenLayers/SingleFile.js59 *60 * Returns:61 * {String} Path to this script62 */63 _getScriptLocation: (function() {64 var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)"),65 s = document.getElementsByTagName('script'),66 src, m, l = "";67 for(var i=0, len=s.length; i<len; i++) {68 src = s[i].getAttribute('src');69 if(src) {70 var m = src.match(r);71 if(m) {72 l = m[1];73 break;74 }75 }76 }77 return (function() { return l; });78 })()79 };80 /**81 * OpenLayers.singleFile is a flag indicating this file is being included82 * in a Single File Library build of the OpenLayers Library.83 * 84 * When we are *not* part of a SFL build we dynamically include the85 * OpenLayers library code.86 * 87 * When we *are* part of a SFL build we do not dynamically include the 88 * OpenLayers library code as it will be appended at the end of this file.89 */90 if(!singleFile) {91 if (!jsFiles) {92 jsFiles = [93 "OpenLayers/BaseTypes/Class.js",94 "OpenLayers/Util.js",95 "OpenLayers/BaseTypes.js",96 "OpenLayers/BaseTypes/Bounds.js",97 "OpenLayers/BaseTypes/Date.js",98 "OpenLayers/BaseTypes/Element.js",99 "OpenLayers/BaseTypes/LonLat.js",100 "OpenLayers/BaseTypes/Pixel.js",101 "OpenLayers/BaseTypes/Size.js",102 "OpenLayers/Console.js",103 "OpenLayers/Tween.js",104 "OpenLayers/Kinetic.js",105 "Rico/Corner.js",106 "Rico/Color.js",107 "OpenLayers/Ajax.js",108 "OpenLayers/Events.js",109 "OpenLayers/Request.js",110 "OpenLayers/Request/XMLHttpRequest.js",111 "OpenLayers/Projection.js",112 "OpenLayers/Map.js",113 "OpenLayers/Layer.js",114 "OpenLayers/Icon.js",115 "OpenLayers/Marker.js",116 "OpenLayers/Marker/Box.js",117 "OpenLayers/Popup.js",118 "OpenLayers/Tile.js",119 "OpenLayers/Tile/Image.js",120 "OpenLayers/Tile/Image/IFrame.js",121 "OpenLayers/Tile/WFS.js",122 "OpenLayers/Layer/Image.js",123 "OpenLayers/Layer/SphericalMercator.js",124 "OpenLayers/Layer/EventPane.js",125 "OpenLayers/Layer/FixedZoomLevels.js",126 "OpenLayers/Layer/Google.js",127 "OpenLayers/Layer/Google/v3.js",128 "OpenLayers/Layer/VirtualEarth.js",129 "OpenLayers/Layer/Yahoo.js",130 "OpenLayers/Layer/HTTPRequest.js",131 "OpenLayers/Layer/Grid.js",132 "OpenLayers/Layer/MapGuide.js",133 "OpenLayers/Layer/MapServer.js",134 "OpenLayers/Layer/MapServer/Untiled.js",135 "OpenLayers/Layer/KaMap.js",136 "OpenLayers/Layer/KaMapCache.js",137 "OpenLayers/Layer/MultiMap.js",138 "OpenLayers/Layer/Markers.js",139 "OpenLayers/Layer/Text.js",140 "OpenLayers/Layer/WorldWind.js",141 "OpenLayers/Layer/ArcGIS93Rest.js",142 "OpenLayers/Layer/WMS.js",143 "OpenLayers/Layer/WMS/Untiled.js",144 "OpenLayers/Layer/WMS/Post.js",145 "OpenLayers/Layer/WMTS.js",146 "OpenLayers/Layer/ArcIMS.js",147 "OpenLayers/Layer/GeoRSS.js",148 "OpenLayers/Layer/Boxes.js",149 "OpenLayers/Layer/XYZ.js",150 "OpenLayers/Layer/Bing.js",151 "OpenLayers/Layer/TMS.js",152 "OpenLayers/Layer/TileCache.js",153 "OpenLayers/Layer/Zoomify.js",154 "OpenLayers/Layer/ArcGISCache.js",155 "OpenLayers/Popup/Anchored.js",156 "OpenLayers/Popup/AnchoredBubble.js",157 "OpenLayers/Popup/Framed.js",158 "OpenLayers/Popup/FramedCloud.js",159 "OpenLayers/Feature.js",160 "OpenLayers/Feature/Vector.js",161 "OpenLayers/Feature/WFS.js",162 "OpenLayers/Handler.js",163 "OpenLayers/Handler/Click.js",164 "OpenLayers/Handler/Hover.js",165 "OpenLayers/Handler/Point.js",166 "OpenLayers/Handler/Path.js",167 "OpenLayers/Handler/Polygon.js",168 "OpenLayers/Handler/Feature.js",169 "OpenLayers/Handler/Drag.js",170 "OpenLayers/Handler/Pinch.js",171 "OpenLayers/Handler/RegularPolygon.js",172 "OpenLayers/Handler/Box.js",173 "OpenLayers/Handler/MouseWheel.js",174 "OpenLayers/Handler/Keyboard.js",175 "OpenLayers/Control.js",176 "OpenLayers/Control/Attribution.js",177 "OpenLayers/Control/Button.js",178 "OpenLayers/Control/ZoomBox.js",179 "OpenLayers/Control/ZoomToMaxExtent.js",180 "OpenLayers/Control/DragPan.js",181 "OpenLayers/Control/Navigation.js",182 "OpenLayers/Control/PinchZoom.js",183 "OpenLayers/Control/TouchNavigation.js",184 "OpenLayers/Control/MouseDefaults.js",185 "OpenLayers/Control/MousePosition.js",186 "OpenLayers/Control/OverviewMap.js",187 "OpenLayers/Control/KeyboardDefaults.js",188 "OpenLayers/Control/PanZoom.js",189 "OpenLayers/Control/PanZoomBar.js",190 "OpenLayers/Control/ArgParser.js",191 "OpenLayers/Control/Permalink.js",192 "OpenLayers/Control/Scale.js",193 "OpenLayers/Control/ScaleLine.js",194 "OpenLayers/Control/Snapping.js",195 "OpenLayers/Control/Split.js",196 "OpenLayers/Control/LayerSwitcher.js",197 "OpenLayers/Control/DrawFeature.js",198 "OpenLayers/Control/DragFeature.js",199 "OpenLayers/Control/ModifyFeature.js",200 "OpenLayers/Control/Panel.js",201 "OpenLayers/Control/SelectFeature.js",202 "OpenLayers/Control/NavigationHistory.js",203 "OpenLayers/Control/Measure.js",204 "OpenLayers/Control/WMSGetFeatureInfo.js",205 "OpenLayers/Control/WMTSGetFeatureInfo.js",206 "OpenLayers/Control/Graticule.js",207 "OpenLayers/Control/TransformFeature.js",208 "OpenLayers/Control/SLDSelect.js",209 "OpenLayers/Geometry.js",210 "OpenLayers/Geometry/Rectangle.js",211 "OpenLayers/Geometry/Collection.js",212 "OpenLayers/Geometry/Point.js",213 "OpenLayers/Geometry/MultiPoint.js",214 "OpenLayers/Geometry/Curve.js",215 "OpenLayers/Geometry/LineString.js",216 "OpenLayers/Geometry/LinearRing.js",217 "OpenLayers/Geometry/Polygon.js",218 "OpenLayers/Geometry/MultiLineString.js",219 "OpenLayers/Geometry/MultiPolygon.js",220 "OpenLayers/Geometry/Surface.js",221 "OpenLayers/Renderer.js",222 "OpenLayers/Renderer/Elements.js",223 "OpenLayers/Renderer/NG.js",224 "OpenLayers/Renderer/SVG.js",225 "OpenLayers/Renderer/SVG2.js",226 "OpenLayers/Renderer/Canvas.js",227 "OpenLayers/Renderer/VML.js",228 "OpenLayers/Layer/Vector.js",229 "OpenLayers/Layer/PointGrid.js",230 "OpenLayers/Layer/Vector/RootContainer.js",231 "OpenLayers/Strategy.js",232 "OpenLayers/Strategy/Filter.js",233 "OpenLayers/Strategy/Fixed.js",234 "OpenLayers/Strategy/Cluster.js",235 "OpenLayers/Strategy/Paging.js",236 "OpenLayers/Strategy/BBOX.js",237 "OpenLayers/Strategy/Save.js",238 "OpenLayers/Strategy/Refresh.js",239 "OpenLayers/Filter.js",240 "OpenLayers/Filter/FeatureId.js",241 "OpenLayers/Filter/Logical.js",242 "OpenLayers/Filter/Comparison.js",243 "OpenLayers/Filter/Spatial.js",244 "OpenLayers/Filter/Function.js", 245 "OpenLayers/Protocol.js",246 "OpenLayers/Protocol/HTTP.js",247 "OpenLayers/Protocol/SQL.js",248 "OpenLayers/Protocol/SQL/Gears.js",249 "OpenLayers/Protocol/WFS.js",250 "OpenLayers/Protocol/WFS/v1.js",251 "OpenLayers/Protocol/WFS/v1_0_0.js",252 "OpenLayers/Protocol/WFS/v1_1_0.js",253 "OpenLayers/Protocol/Script.js",254 "OpenLayers/Protocol/SOS.js",255 "OpenLayers/Protocol/SOS/v1_0_0.js",256 "OpenLayers/Layer/PointTrack.js",257 "OpenLayers/Layer/GML.js",258 "OpenLayers/Style.js",259 "OpenLayers/Style2.js",260 "OpenLayers/StyleMap.js",261 "OpenLayers/Rule.js",262 "OpenLayers/Format.js",263 "OpenLayers/Format/QueryStringFilter.js",264 "OpenLayers/Format/XML.js",265 "OpenLayers/Format/XML/VersionedOGC.js",266 "OpenLayers/Format/Context.js",267 "OpenLayers/Format/ArcXML.js",268 "OpenLayers/Format/ArcXML/Features.js",269 "OpenLayers/Format/GML.js",270 "OpenLayers/Format/GML/Base.js",271 "OpenLayers/Format/GML/v2.js",272 "OpenLayers/Format/GML/v3.js",273 "OpenLayers/Format/Atom.js",274 "OpenLayers/Format/KML.js",275 "OpenLayers/Format/GeoRSS.js",276 "OpenLayers/Format/WFS.js",277 "OpenLayers/Format/WFSCapabilities.js",278 "OpenLayers/Format/WFSCapabilities/v1.js",279 "OpenLayers/Format/WFSCapabilities/v1_0_0.js",280 "OpenLayers/Format/WFSCapabilities/v1_1_0.js",281 "OpenLayers/Format/WFSDescribeFeatureType.js",282 "OpenLayers/Format/WMSDescribeLayer.js",283 "OpenLayers/Format/WMSDescribeLayer/v1_1.js",284 "OpenLayers/Format/WKT.js",285 "OpenLayers/Format/CQL.js",286 "OpenLayers/Format/OSM.js",287 "OpenLayers/Format/GPX.js",288 "OpenLayers/Format/Filter.js",289 "OpenLayers/Format/Filter/v1.js",290 "OpenLayers/Format/Filter/v1_0_0.js",291 "OpenLayers/Format/Filter/v1_1_0.js",292 "OpenLayers/Format/SLD.js",293 "OpenLayers/Format/SLD/v1.js",294 "OpenLayers/Format/SLD/v1_0_0.js",295 "OpenLayers/Format/OWSCommon.js",296 "OpenLayers/Format/OWSCommon/v1.js",297 "OpenLayers/Format/OWSCommon/v1_0_0.js",298 "OpenLayers/Format/OWSCommon/v1_1_0.js",299 "OpenLayers/Format/CSWGetDomain.js",300 "OpenLayers/Format/CSWGetDomain/v2_0_2.js",301 "OpenLayers/Format/CSWGetRecords.js",302 "OpenLayers/Format/CSWGetRecords/v2_0_2.js",303 "OpenLayers/Format/WFST.js",304 "OpenLayers/Format/WFST/v1.js",305 "OpenLayers/Format/WFST/v1_0_0.js",306 "OpenLayers/Format/WFST/v1_1_0.js",307 "OpenLayers/Format/Text.js",308 "OpenLayers/Format/JSON.js",309 "OpenLayers/Format/GeoJSON.js",310 "OpenLayers/Format/WMC.js",311 "OpenLayers/Format/WMC/v1.js",312 "OpenLayers/Format/WMC/v1_0_0.js",313 "OpenLayers/Format/WMC/v1_1_0.js",314 "OpenLayers/Format/WCSGetCoverage.js",315 "OpenLayers/Format/WMSCapabilities.js",316 "OpenLayers/Format/WMSCapabilities/v1.js",317 "OpenLayers/Format/WMSCapabilities/v1_1.js",318 "OpenLayers/Format/WMSCapabilities/v1_1_0.js",319 "OpenLayers/Format/WMSCapabilities/v1_1_1.js",320 "OpenLayers/Format/WMSCapabilities/v1_3.js",321 "OpenLayers/Format/WMSCapabilities/v1_3_0.js",322 "OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js",323 "OpenLayers/Format/WMSGetFeatureInfo.js",324 "OpenLayers/Format/SOSCapabilities.js",325 "OpenLayers/Format/SOSCapabilities/v1_0_0.js",326 "OpenLayers/Format/SOSGetFeatureOfInterest.js",327 "OpenLayers/Format/SOSGetObservation.js",328 "OpenLayers/Format/OWSContext.js",329 "OpenLayers/Format/OWSContext/v0_3_1.js",330 "OpenLayers/Format/WMTSCapabilities.js",331 "OpenLayers/Format/WMTSCapabilities/v1_0_0.js",332 "OpenLayers/Format/WPSCapabilities.js",333 "OpenLayers/Format/WPSCapabilities/v1_0_0.js",334 "OpenLayers/Format/WPSDescribeProcess.js",335 "OpenLayers/Format/WPSExecute.js",336 "OpenLayers/Format/XLS.js",337 "OpenLayers/Format/XLS/v1.js",338 "OpenLayers/Format/XLS/v1_1_0.js",339 "OpenLayers/Format/OGCExceptionReport.js",340 "OpenLayers/Layer/WFS.js",341 "OpenLayers/Control/GetFeature.js",342 "OpenLayers/Control/MouseToolbar.js",343 "OpenLayers/Control/NavToolbar.js",344 "OpenLayers/Control/PanPanel.js",345 "OpenLayers/Control/Pan.js",346 "OpenLayers/Control/ZoomIn.js",347 "OpenLayers/Control/ZoomOut.js",348 "OpenLayers/Control/ZoomPanel.js",349 "OpenLayers/Control/EditingToolbar.js",350 "OpenLayers/Control/Geolocate.js",351 "OpenLayers/Symbolizer.js",352 "OpenLayers/Symbolizer/Point.js",353 "OpenLayers/Symbolizer/Line.js",354 "OpenLayers/Symbolizer/Polygon.js",355 "OpenLayers/Symbolizer/Text.js",356 "OpenLayers/Symbolizer/Raster.js",357 "OpenLayers/Lang.js",358 "OpenLayers/Lang/en.js"359 ]; // etc.360 }361 // use "parser-inserted scripts" for guaranteed execution order362 // http://hsivonen.iki.fi/script-execution/363 var scriptTags = new Array(jsFiles.length);364 var host = OpenLayers._getScriptLocation() + "lib/";365 for (var i=0, len=jsFiles.length; i<len; i++) {366 scriptTags[i] = "<script src='" + host + jsFiles[i] +367 "'></script>"; 368 }369 if (scriptTags.length > 0) {370 document.write(scriptTags.join(""));371 }372 }373})();374/**375 * Constant: VERSION_NUMBER376 */...
custom.js
Source:custom.js
1(function ($) {2 3 // -------------4 // Accordion excelencia academica5 6 $(".acordion1 a").click(function() {7 $(".content_accordion_1").toggleClass("open");8 $(".acordion1 a").toggleClass("open");9 $('.content_accordion_2').removeClass('open');10 $('.acordion2 a').removeClass('open');11 $('.content_accordion_3').removeClass('open');12 $('.acordion3 a').removeClass('open');13 $('.content_accordion_4').removeClass('open');14 $('.acordion4 a').removeClass('open');15 $('.content_accordion_5').removeClass('open');16 $('.acordion5 a').removeClass('open');17 $('.content_accordion_6').removeClass('open');18 $('.acordion6 a').removeClass('open');19 });20 21 $(".content_accordion_1 .close-button").click(function() {22 $(".content_accordion_1").toggleClass("open");23 $(".acordion1 a").toggleClass("open");24 });25 26 27 28 29 // -------------30 // Accordion grupos especiales31 32 $(".acordion2 a").click(function() {33 $(".content_accordion_2").toggleClass("open");34 $(".acordion2 a").toggleClass("open");35 $('.content_accordion_1').removeClass('open');36 $('.acordion1 a').removeClass('open');37 $('.content_accordion_3').removeClass('open');38 $('.acordion3 a').removeClass('open');39 $('.content_accordion_4').removeClass('open');40 $('.acordion4 a').removeClass('open');41 $('.content_accordion_5').removeClass('open');42 $('.acordion5 a').removeClass('open');43 $('.content_accordion_6').removeClass('open');44 $('.acordion6 a').removeClass('open');45 });46 47 $(".content_accordion_2 .close-button").click(function() {48 $(".content_accordion_2").toggleClass("open");49 $(".acordion2 a").toggleClass("open");50 });51 52 53 54 55 56 // -------------57 // Accordion merito academico58 59 $(".acordion3 a").click(function() {60 $(".content_accordion_3").toggleClass("open");61 $(".acordion3 a").toggleClass("open");62 $('.content_accordion_1').removeClass('open');63 $('.acordion1 a').removeClass('open');64 $('.content_accordion_2').removeClass('open');65 $('.acordion2 a').removeClass('open');66 $('.content_accordion_4').removeClass('open');67 $('.acordion4 a').removeClass('open');68 $('.content_accordion_5').removeClass('open');69 $('.acordion5 a').removeClass('open');70 $('.content_accordion_6').removeClass('open');71 $('.acordion6 a').removeClass('open');72 });73 74 $(".content_accordion_3 .close-button").click(function() {75 $(".content_accordion_3").toggleClass("open");76 $(".acordion3 a").toggleClass("open");77 });78 79 80 // -------------81 // Programa semillas82 83 $(".acordion4 a").click(function() {84 $(".content_accordion_4").toggleClass("open");85 $(".acordion4 a").toggleClass("open");86 $('.content_accordion_1').removeClass('open');87 $('.acordion1 a').removeClass('open');88 $('.content_accordion_2').removeClass('open');89 $('.acordion2 a').removeClass('open');90 $('.content_accordion_3').removeClass('open');91 $('.acordion3 a').removeClass('open');92 $('.content_accordion_5').removeClass('open');93 $('.acordion5 a').removeClass('open');94 $('.content_accordion_6').removeClass('open');95 $('.acordion6 a').removeClass('open');96 });97 98 $(".content_accordion_4 .close-button").click(function() {99 $(".content_accordion_4").toggleClass("open");100 $(".acordion4 a").toggleClass("open");101 });102 103 104 // -------------105 // Economia naranja106 107 $(".acordion5 a").click(function() {108 $(".content_accordion_5").toggleClass("open");109 $(".acordion5 a").toggleClass("open");110 $('.content_accordion_1').removeClass('open');111 $('.acordion1 a').removeClass('open');112 $('.content_accordion_2').removeClass('open');113 $('.acordion2 a').removeClass('open');114 $('.content_accordion_3').removeClass('open');115 $('.acordion3 a').removeClass('open');116 $('.content_accordion_4').removeClass('open');117 $('.acordion4 a').removeClass('open');118 $('.content_accordion_6').removeClass('open');119 $('.acordion6 a').removeClass('open');120 });121 122 $(".content_accordion_5 .close-button").click(function() {123 $(".content_accordion_5").toggleClass("open");124 $(".acordion5 a").toggleClass("open");125 });126 127 128 // -------------129 // fundacion bolivar130 131 $(".acordion6 a").click(function() {132 $(".content_accordion_6").toggleClass("open");133 $(".acordion6 a").toggleClass("open");134 $('.content_accordion_1').removeClass('open');135 $('.acordion1 a').removeClass('open');136 $('.content_accordion_2').removeClass('open');137 $('.acordion2 a').removeClass('open');138 $('.content_accordion_3').removeClass('open');139 $('.acordion3 a').removeClass('open');140 $('.content_accordion_4').removeClass('open');141 $('.acordion4 a').removeClass('open');142 $('.content_accordion_5').removeClass('open');143 $('.acordion5 a').removeClass('open');144 });145 146 $(".content_accordion_6 .close-button").click(function() {147 $(".content_accordion_6").toggleClass("open");148 $(".acordion6 a").toggleClass("open");149 });150 151 152 153 // -------------154 // resultados consultar155 156 $(".resultados_convocatoria a").click(function() {157 $(".resultados_consultar").toggleClass("open");158 $(".resultados_convocatoria a").toggleClass("open");159 });160 161 $(".resultados_convocatoria .close-button").click(function() {162 $(".resultados_consultar").toggleClass("open");163 $(".resultados_convocatoria a").toggleClass("open");164 });165 166 167 168 // -------------169 // qas 1170 171 $(".qas .qa1").click(function() {172 $(".resultados_qa1").toggleClass("open");173 $(".qas .qa1").toggleClass("open");174 });175 176 $(".resultados_qa1 .close-button").click(function() {177 $(".resultados_qa1").toggleClass("open");178 $(".qas .qa1").toggleClass("open");179 });180 181 182 // -------------183 // qas 2184 185 $(".qas .qa2").click(function() {186 $(".resultados_qa2").toggleClass("open");187 $(".qas .qa2").toggleClass("open");188 });189 190 $(".resultados_qa2 .close-button").click(function() {191 $(".resultados_qa2").toggleClass("open");192 $(".qas .qa2").toggleClass("open");193 });194 195 196 // -------------197 // qas 3198 199 $(".qas .qa3").click(function() {200 $(".resultados_qa3").toggleClass("open");201 $(".qas .qa3").toggleClass("open");202 });203 204 $(".resultados_qa3 .close-button").click(function() {205 $(".resultados_qa3").toggleClass("open");206 $(".qas .qa3").toggleClass("open");207 });208 209 210 211 // -------------212 // qas 4213 214 $(".qas .qa4").click(function() {215 $(".resultados_qa4").toggleClass("open");216 $(".qas .qa4").toggleClass("open");217 });218 219 $(".resultados_qa4 .close-button").click(function() {220 $(".resultados_qa4").toggleClass("open");221 $(".qas .qa4").toggleClass("open");222 });223 224 225 // -------------226 // qas 5227 228 $(".qas .qa5").click(function() {229 $(".resultados_qa5").toggleClass("open");230 $(".qas .qa5").toggleClass("open");231 });232 233 $(".resultados_qa5 .close-button").click(function() {234 $(".resultados_qa5").toggleClass("open");235 $(".qas .qa5").toggleClass("open");236 });237 238 239 // -------------240 // qas 6241 242 $(".qas .qa6").click(function() {243 $(".resultados_qa6").toggleClass("open");244 $(".qas .qa6").toggleClass("open");245 });246 247 $(".resultados_qa6 .close-button").click(function() {248 $(".resultados_qa6").toggleClass("open");249 $(".qas .qa6").toggleClass("open");250 });251 252 253 // -------------254 // qas 7255 256 $(".qas .qa7").click(function() {257 $(".resultados_qa7").toggleClass("open");258 $(".qas .qa7").toggleClass("open");259 });260 261 $(".resultados_qa7 .close-button").click(function() {262 $(".resultados_qa7").toggleClass("open");263 $(".qas .qa7").toggleClass("open");264 });265 266 267 // -------------268 // qas 8269 270 $(".qas .qa8").click(function() {271 $(".resultados_qa8").toggleClass("open");272 $(".qas .qa8").toggleClass("open");273 });274 275 $(".resultados_qa8 .close-button").click(function() {276 $(".resultados_qa8").toggleClass("open");277 $(".qas .qa8").toggleClass("open");278 });279 280 281 // -------------282 // qas 9283 284 $(".qas .qa9").click(function() {285 $(".resultados_qa9").toggleClass("open");286 $(".qas .qa9").toggleClass("open");287 });288 289 $(".resultados_qa9 .close-button").click(function() {290 $(".resultados_qa9").toggleClass("open");291 $(".qas .qa9").toggleClass("open");292 });293 294 295 // -------------296 // qas 10297 298 $(".qas .qa10").click(function() {299 $(".resultados_qa10").toggleClass("open");300 $(".qas .qa10").toggleClass("open");301 });302 303 $(".resultados_qa10 .close-button").click(function() {304 $(".resultados_qa10").toggleClass("open");305 $(".qas .qa10").toggleClass("open");306 });307 308 309 // -------------310 // qas 11311 312 $(".qas .qa11").click(function() {313 $(".resultados_qa11").toggleClass("open");314 $(".qas .qa11").toggleClass("open");315 });316 317 $(".resultados_qa11 .close-button").click(function() {318 $(".resultados_qa11").toggleClass("open");319 $(".qas .qa11").toggleClass("open");320 });321 322 323 // -------------324 // qas 12325 326 $(".qas .qa12").click(function() {327 $(".resultados_qa12").toggleClass("open");328 $(".qas .qa12").toggleClass("open");329 });330 331 $(".resultados_qa12 .close-button").click(function() {332 $(".resultados_qa12").toggleClass("open");333 $(".qas .qa12").toggleClass("open");334 });335 336 337 // -------------338 // qas 13339 340 $(".qas .qa13").click(function() {341 $(".resultados_qa13").toggleClass("open");342 $(".qas .qa13").toggleClass("open");343 });344 345 $(".resultados_qa13 .close-button").click(function() {346 $(".resultados_qa13").toggleClass("open");347 $(".qas .qa13").toggleClass("open");348 });349 350 // -------------351 // qas 14352 353 $(".qas .qa14").click(function() {354 $(".resultados_qa14").toggleClass("open");355 $(".qas .qa14").toggleClass("open");356 });357 358 $(".resultados_qa14 .close-button").click(function() {359 $(".resultados_qa14").toggleClass("open");360 $(".qas .qa14").toggleClass("open");361 });362 363 364 // -------------365 // donar366 367 $(".btn_donar a").click(function() {368 $(".btn_donar a").toggleClass("open");369 $(".donar .resultados_donar").toggleClass("open");370 });371 372 $(".resultados_donar .close-button").click(function() {373 $(".btn_donar a").toggleClass("open");374 $(".donar .resultados_donar").toggleClass("open");375 });376 377 // -------------378 // donar header379 380 $(".btn_donar a").click(function() {381 $(".btn_donar a").toggleClass("open");382 $(".btn_donacion .resultados_donar").toggleClass("open");383 });384 385 $(".resultados_donar .close-button").click(function() {386 $(".btn_donar a").toggleClass("open");387 $(".btn_donacion .resultados_donar").toggleClass("open");388 });389 390 // -------------391 // educacion calidad392 393 $(".btn_ODS .logo_ODS").click(function() {394 $(".btn_ODS .logo_ODS").toggleClass("open");395 $(".aliados .resultados_ODS").toggleClass("open");396 });397 398 $(".resultados_ODS .close-button").click(function() {399 $(".btn_ODS .logo_ODS").toggleClass("open");400 $(".aliados .resultados_ODS").toggleClass("open");401 });402 403 // -------------404 // aliados405 406 $(".btn_aliados a").click(function() {407 $(".btn_aliados a").toggleClass("open");408 $(".aliados .resultados_aliados").toggleClass("open");409 });410 411 $(".resultados_aliados .close-button").click(function() {412 $(".btn_aliados a").toggleClass("open");413 $(".aliados .resultados_aliados").toggleClass("open");414 });415 416 417 // -------------418 // pop up inicial419 420 $(".popup-enter .close-button").click(function() {421 $(".popup-enter").toggleClass("close");422 });423 424 425 // -------------426 // resultados entidades aliadas427 428 $(".acordion7 a").click(function() {429 $(".content_accordion_7").toggleClass("open");430 $(".acordion7 a").toggleClass("open");431 });432 433 $(".content_accordion_7 .close-button").click(function() {434 $(".content_accordion_7").toggleClass("open");435 $(".acordion7 a").toggleClass("open");436 });437 438 439 $(document).ready(function(){440 $('.slider-becas').slick({441 slidesToShow: 3,442 slidesToScroll: 1,443 autoplay: true,444 autoplaySpeed: 3000,445 infinite: false,446 arrows:true,447 infinite: true,448 cssEase: 'linear',449 swipe: false,450 pauseOnHover:true,451 prevArrow: $('.next'),452 nextArrow: $('.prev'),453 // the magic454 responsive: [455 {456 breakpoint: 991,457 settings: {458 slidesToShow: 2,459 infinite: true,460 settings: 'unslick'461 }462 463 }, 464 {465 breakpoint: 768,466 settings: {467 slidesToShow: 1,468 infinite: true,469 settings: 'unslick'470 }471 472 }]473 });474 });475 476 $(document).ready(function(){477 $('.slider-videos').slick({478 slidesToShow: 1,479 slidesToScroll: 1,480 autoplay: true,481 autoplaySpeed: 3000,482 infinite: true,483 arrows:true,484 infinite: true,485 cssEase: 'linear',486 swipe: false,487 pauseOnHover:true,488 prevArrow: $('.next1'),489 nextArrow: $('.prev1'),490 });491 });492 493 $(document).ready(function(){494 $('.slider-becas-2').slick({495 slidesToShow: 3,496 slidesToScroll: 1,497 autoplay: true,498 autoplaySpeed: 3000,499 infinite: true,500 arrows:true,501 infinite: true,502 cssEase: 'linear',503 swipe: false,504 pauseOnHover:true,505 prevArrow: $('.next2'),506 nextArrow: $('.prev2'),507 // the magic508 responsive: [509 {510 breakpoint: 991,511 settings: {512 slidesToShow: 2,513 infinite: true,514 settings: 'unslick'515 }516 517 }, 518 {519 breakpoint: 768,520 settings: {521 slidesToShow: 1,522 infinite: true,523 settings: 'unslick'524 }525 526 }]527 });528 });529 530 $(document).ready(function(){531 $('.slider-aliados').slick({532 dots: true,533 slidesToShow: 4,534 slidesToScroll: 1,535 autoplay: true,536 autoplaySpeed: 3000,537 infinite: false,538 arrows:false,539 infinite: true,540 cssEase: 'linear',541 swipe: false,542 pauseOnHover:true,543 // the magic544 responsive: [545 {546 breakpoint: 991,547 settings: {548 slidesToShow: 2,549 infinite: true,550 settings: 'unslick'551 }552 553 }, 554 {555 breakpoint: 768,556 settings: {557 slidesToShow: 1,558 infinite: true,559 settings: 'unslick'560 }561 562 }]563 });564 });565 566 ...
cases.js
Source:cases.js
1var xml = new OpenLayers.Format.XML(); 2function readXML(file) {3 return xml.read(document.getElementById(file).firstChild.nodeValue);4}5var cases = {6 "v2/point-coord.xml": new OpenLayers.Geometry.Point(1, 2),7 "v2/point-coordinates.xml": new OpenLayers.Geometry.Point(1, 2),8 "v2/linestring-coord.xml": new OpenLayers.Geometry.LineString([9 new OpenLayers.Geometry.Point(1, 2),10 new OpenLayers.Geometry.Point(3, 4)11 ]),12 13 "v2/linestring-coordinates.xml": new OpenLayers.Geometry.LineString([14 new OpenLayers.Geometry.Point(1, 2),15 new OpenLayers.Geometry.Point(3, 4)16 ]),17 18 "v2/linearring-coord.xml": new OpenLayers.Geometry.LinearRing([19 new OpenLayers.Geometry.Point(1, 2),20 new OpenLayers.Geometry.Point(3, 4),21 new OpenLayers.Geometry.Point(5, 6),22 new OpenLayers.Geometry.Point(1, 2)23 ]),24 25 "v2/linearring-coordinates.xml": new OpenLayers.Geometry.LinearRing([26 new OpenLayers.Geometry.Point(1, 2),27 new OpenLayers.Geometry.Point(3, 4),28 new OpenLayers.Geometry.Point(5, 6),29 new OpenLayers.Geometry.Point(1, 2)30 ]),31 32 "v2/polygon-coord.xml": new OpenLayers.Geometry.Polygon([33 new OpenLayers.Geometry.LinearRing([34 new OpenLayers.Geometry.Point(1, 2),35 new OpenLayers.Geometry.Point(3, 4),36 new OpenLayers.Geometry.Point(5, 6),37 new OpenLayers.Geometry.Point(1, 2)38 ]),39 new OpenLayers.Geometry.LinearRing([40 new OpenLayers.Geometry.Point(2, 3),41 new OpenLayers.Geometry.Point(4, 5),42 new OpenLayers.Geometry.Point(6, 7),43 new OpenLayers.Geometry.Point(2, 3)44 ]),45 new OpenLayers.Geometry.LinearRing([46 new OpenLayers.Geometry.Point(3, 4),47 new OpenLayers.Geometry.Point(5, 6),48 new OpenLayers.Geometry.Point(7, 8),49 new OpenLayers.Geometry.Point(3, 4)50 ])51 ]),52 53 "v2/polygon-coordinates.xml": new OpenLayers.Geometry.Polygon([54 new OpenLayers.Geometry.LinearRing([55 new OpenLayers.Geometry.Point(1, 2),56 new OpenLayers.Geometry.Point(3, 4),57 new OpenLayers.Geometry.Point(5, 6),58 new OpenLayers.Geometry.Point(1, 2)59 ]),60 new OpenLayers.Geometry.LinearRing([61 new OpenLayers.Geometry.Point(2, 3),62 new OpenLayers.Geometry.Point(4, 5),63 new OpenLayers.Geometry.Point(6, 7),64 new OpenLayers.Geometry.Point(2, 3)65 ]),66 new OpenLayers.Geometry.LinearRing([67 new OpenLayers.Geometry.Point(3, 4),68 new OpenLayers.Geometry.Point(5, 6),69 new OpenLayers.Geometry.Point(7, 8),70 new OpenLayers.Geometry.Point(3, 4)71 ])72 ]),73 74 "v2/multipoint-coord.xml": new OpenLayers.Geometry.MultiPoint([75 new OpenLayers.Geometry.Point(1, 2),76 new OpenLayers.Geometry.Point(2, 3),77 new OpenLayers.Geometry.Point(3, 4)78 ]),79 80 "v2/multipoint-coordinates.xml": new OpenLayers.Geometry.MultiPoint([81 new OpenLayers.Geometry.Point(1, 2),82 new OpenLayers.Geometry.Point(2, 3),83 new OpenLayers.Geometry.Point(3, 4)84 ]),85 86 "v2/multilinestring-coord.xml": new OpenLayers.Geometry.MultiLineString([87 new OpenLayers.Geometry.LineString([88 new OpenLayers.Geometry.Point(1, 2),89 new OpenLayers.Geometry.Point(2, 3)90 ]),91 new OpenLayers.Geometry.LineString([92 new OpenLayers.Geometry.Point(3, 4),93 new OpenLayers.Geometry.Point(4, 5)94 ])95 ]),96 97 "v2/multilinestring-coordinates.xml": new OpenLayers.Geometry.MultiLineString([98 new OpenLayers.Geometry.LineString([99 new OpenLayers.Geometry.Point(1, 2),100 new OpenLayers.Geometry.Point(2, 3)101 ]),102 new OpenLayers.Geometry.LineString([103 new OpenLayers.Geometry.Point(3, 4),104 new OpenLayers.Geometry.Point(4, 5)105 ])106 ]),107 108 "v2/multipolygon-coord.xml": new OpenLayers.Geometry.MultiPolygon([109 new OpenLayers.Geometry.Polygon([110 new OpenLayers.Geometry.LinearRing([111 new OpenLayers.Geometry.Point(1, 2),112 new OpenLayers.Geometry.Point(3, 4),113 new OpenLayers.Geometry.Point(5, 6),114 new OpenLayers.Geometry.Point(1, 2)115 ]),116 new OpenLayers.Geometry.LinearRing([117 new OpenLayers.Geometry.Point(2, 3),118 new OpenLayers.Geometry.Point(4, 5),119 new OpenLayers.Geometry.Point(6, 7),120 new OpenLayers.Geometry.Point(2, 3)121 ]),122 new OpenLayers.Geometry.LinearRing([123 new OpenLayers.Geometry.Point(3, 4),124 new OpenLayers.Geometry.Point(5, 6),125 new OpenLayers.Geometry.Point(7, 8),126 new OpenLayers.Geometry.Point(3, 4)127 ])128 ]),129 new OpenLayers.Geometry.Polygon([130 new OpenLayers.Geometry.LinearRing([131 new OpenLayers.Geometry.Point(1, 2),132 new OpenLayers.Geometry.Point(3, 4),133 new OpenLayers.Geometry.Point(5, 6),134 new OpenLayers.Geometry.Point(1, 2)135 ])136 ])137 ]),138 139 "v2/multipolygon-coordinates.xml": new OpenLayers.Geometry.MultiPolygon([140 new OpenLayers.Geometry.Polygon([141 new OpenLayers.Geometry.LinearRing([142 new OpenLayers.Geometry.Point(1, 2),143 new OpenLayers.Geometry.Point(3, 4),144 new OpenLayers.Geometry.Point(5, 6),145 new OpenLayers.Geometry.Point(1, 2)146 ]),147 new OpenLayers.Geometry.LinearRing([148 new OpenLayers.Geometry.Point(2, 3),149 new OpenLayers.Geometry.Point(4, 5),150 new OpenLayers.Geometry.Point(6, 7),151 new OpenLayers.Geometry.Point(2, 3)152 ]),153 new OpenLayers.Geometry.LinearRing([154 new OpenLayers.Geometry.Point(3, 4),155 new OpenLayers.Geometry.Point(5, 6),156 new OpenLayers.Geometry.Point(7, 8),157 new OpenLayers.Geometry.Point(3, 4)158 ])159 ]),160 new OpenLayers.Geometry.Polygon([161 new OpenLayers.Geometry.LinearRing([162 new OpenLayers.Geometry.Point(1, 2),163 new OpenLayers.Geometry.Point(3, 4),164 new OpenLayers.Geometry.Point(5, 6),165 new OpenLayers.Geometry.Point(1, 2)166 ])167 ])168 ]),169 170 "v2/geometrycollection-coordinates.xml": new OpenLayers.Geometry.Collection([171 new OpenLayers.Geometry.Point(1, 2),172 new OpenLayers.Geometry.LineString([173 new OpenLayers.Geometry.Point(1, 2),174 new OpenLayers.Geometry.Point(3, 4)175 ]),176 new OpenLayers.Geometry.Polygon([177 new OpenLayers.Geometry.LinearRing([178 new OpenLayers.Geometry.Point(1, 2),179 new OpenLayers.Geometry.Point(3, 4),180 new OpenLayers.Geometry.Point(5, 6),181 new OpenLayers.Geometry.Point(1, 2)182 ]),183 new OpenLayers.Geometry.LinearRing([184 new OpenLayers.Geometry.Point(2, 3),185 new OpenLayers.Geometry.Point(4, 5),186 new OpenLayers.Geometry.Point(6, 7),187 new OpenLayers.Geometry.Point(2, 3)188 ]),189 new OpenLayers.Geometry.LinearRing([190 new OpenLayers.Geometry.Point(3, 4),191 new OpenLayers.Geometry.Point(5, 6),192 new OpenLayers.Geometry.Point(7, 8),193 new OpenLayers.Geometry.Point(3, 4)194 ])195 ])196 ]),197 "v2/box-coord.xml": new OpenLayers.Bounds(1, 2, 3, 4),198 199 "v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4)200 201};202// cases for v3 use the same geometries203OpenLayers.Util.extend(cases, {204 "v3/point.xml": cases["v2/point-coordinates.xml"],205 "v3/linestring.xml": cases["v2/linestring-coordinates.xml"],206 "v3/curve.xml": cases["v2/linestring-coordinates.xml"],207 "v3/polygon.xml": cases["v2/polygon-coordinates.xml"],208 "v3/surface.xml": cases["v2/polygon-coordinates.xml"],209 "v3/multipoint-singular.xml": cases["v2/multipoint-coordinates.xml"],210 "v3/multipoint-plural.xml": cases["v2/multipoint-coordinates.xml"],211 "v3/multilinestring-singular.xml": cases["v2/multilinestring-coordinates.xml"],212 "v3/multilinestring-plural.xml": cases["v2/multilinestring-coordinates.xml"],213 "v3/multicurve-singular.xml": cases["v2/multilinestring-coordinates.xml"],214 "v3/multicurve-curve.xml": cases["v2/multilinestring-coordinates.xml"],215 "v3/multipolygon-singular.xml": cases["v2/multipolygon-coordinates.xml"],216 "v3/multipolygon-plural.xml": cases["v2/multipolygon-coordinates.xml"],217 "v3/multisurface-singular.xml": cases["v2/multipolygon-coordinates.xml"],218 "v3/multisurface-plural.xml": cases["v2/multipolygon-coordinates.xml"],219 "v3/multisurface-surface.xml": cases["v2/multipolygon-coordinates.xml"],220 "v3/envelope.xml": cases["v2/box-coordinates.xml"]...
FramedCloud.js
Source:FramedCloud.js
1/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for 2 * full list of contributors). Published under the 2-clause BSD license.3 * See license.txt in the OpenLayers distribution or repository for the4 * full text of the license. */5/**6 * @requires OpenLayers/Popup/Framed.js7 * @requires OpenLayers/Util.js8 * @requires OpenLayers/BaseTypes/Bounds.js9 * @requires OpenLayers/BaseTypes/Pixel.js10 * @requires OpenLayers/BaseTypes/Size.js11 */12/**13 * Class: OpenLayers.Popup.FramedCloud14 * 15 * Inherits from: 16 * - <OpenLayers.Popup.Framed>17 */18OpenLayers.Popup.FramedCloud = 19 OpenLayers.Class(OpenLayers.Popup.Framed, {20 /** 21 * Property: contentDisplayClass22 * {String} The CSS class of the popup content div.23 */24 contentDisplayClass: "olFramedCloudPopupContent",25 /**26 * APIProperty: autoSize27 * {Boolean} Framed Cloud is autosizing by default.28 */29 autoSize: true,30 /**31 * APIProperty: panMapIfOutOfView32 * {Boolean} Framed Cloud does pan into view by default.33 */34 panMapIfOutOfView: true,35 /**36 * APIProperty: imageSize37 * {<OpenLayers.Size>}38 */39 imageSize: new OpenLayers.Size(1276, 736),40 /**41 * APIProperty: isAlphaImage42 * {Boolean} The FramedCloud does not use an alpha image (in honor of the 43 * good ie6 folk out there)44 */45 isAlphaImage: false,46 /** 47 * APIProperty: fixedRelativePosition48 * {Boolean} The Framed Cloud popup works in just one fixed position.49 */50 fixedRelativePosition: false,51 /**52 * Property: positionBlocks53 * {Object} Hash of differen position blocks, keyed by relativePosition54 * two-character code string (ie "tl", "tr", "bl", "br")55 */56 positionBlocks: {57 "tl": {58 'offset': new OpenLayers.Pixel(44, 0),59 'padding': new OpenLayers.Bounds(8, 40, 8, 9),60 'blocks': [61 { // top-left62 size: new OpenLayers.Size('auto', 'auto'),63 anchor: new OpenLayers.Bounds(0, 51, 22, 0),64 position: new OpenLayers.Pixel(0, 0)65 },66 { //top-right67 size: new OpenLayers.Size(22, 'auto'),68 anchor: new OpenLayers.Bounds(null, 50, 0, 0),69 position: new OpenLayers.Pixel(-1238, 0)70 },71 { //bottom-left72 size: new OpenLayers.Size('auto', 19),73 anchor: new OpenLayers.Bounds(0, 32, 22, null),74 position: new OpenLayers.Pixel(0, -631)75 },76 { //bottom-right77 size: new OpenLayers.Size(22, 18),78 anchor: new OpenLayers.Bounds(null, 32, 0, null),79 position: new OpenLayers.Pixel(-1238, -632)80 },81 { // stem82 size: new OpenLayers.Size(81, 35),83 anchor: new OpenLayers.Bounds(null, 0, 0, null),84 position: new OpenLayers.Pixel(0, -688)85 }86 ]87 },88 "tr": {89 'offset': new OpenLayers.Pixel(-45, 0),90 'padding': new OpenLayers.Bounds(8, 40, 8, 9),91 'blocks': [92 { // top-left93 size: new OpenLayers.Size('auto', 'auto'),94 anchor: new OpenLayers.Bounds(0, 51, 22, 0),95 position: new OpenLayers.Pixel(0, 0)96 },97 { //top-right98 size: new OpenLayers.Size(22, 'auto'),99 anchor: new OpenLayers.Bounds(null, 50, 0, 0),100 position: new OpenLayers.Pixel(-1238, 0)101 },102 { //bottom-left103 size: new OpenLayers.Size('auto', 19),104 anchor: new OpenLayers.Bounds(0, 32, 22, null),105 position: new OpenLayers.Pixel(0, -631)106 },107 { //bottom-right108 size: new OpenLayers.Size(22, 19),109 anchor: new OpenLayers.Bounds(null, 32, 0, null),110 position: new OpenLayers.Pixel(-1238, -631)111 },112 { // stem113 size: new OpenLayers.Size(81, 35),114 anchor: new OpenLayers.Bounds(0, 0, null, null),115 position: new OpenLayers.Pixel(-215, -687)116 }117 ]118 },119 "bl": {120 'offset': new OpenLayers.Pixel(45, 0),121 'padding': new OpenLayers.Bounds(8, 9, 8, 40),122 'blocks': [123 { // top-left124 size: new OpenLayers.Size('auto', 'auto'),125 anchor: new OpenLayers.Bounds(0, 21, 22, 32),126 position: new OpenLayers.Pixel(0, 0)127 },128 { //top-right129 size: new OpenLayers.Size(22, 'auto'),130 anchor: new OpenLayers.Bounds(null, 21, 0, 32),131 position: new OpenLayers.Pixel(-1238, 0)132 },133 { //bottom-left134 size: new OpenLayers.Size('auto', 21),135 anchor: new OpenLayers.Bounds(0, 0, 22, null),136 position: new OpenLayers.Pixel(0, -629)137 },138 { //bottom-right139 size: new OpenLayers.Size(22, 21),140 anchor: new OpenLayers.Bounds(null, 0, 0, null),141 position: new OpenLayers.Pixel(-1238, -629)142 },143 { // stem144 size: new OpenLayers.Size(81, 33),145 anchor: new OpenLayers.Bounds(null, null, 0, 0),146 position: new OpenLayers.Pixel(-101, -674)147 }148 ]149 },150 "br": {151 'offset': new OpenLayers.Pixel(-44, 0),152 'padding': new OpenLayers.Bounds(8, 9, 8, 40),153 'blocks': [154 { // top-left155 size: new OpenLayers.Size('auto', 'auto'),156 anchor: new OpenLayers.Bounds(0, 21, 22, 32),157 position: new OpenLayers.Pixel(0, 0)158 },159 { //top-right160 size: new OpenLayers.Size(22, 'auto'),161 anchor: new OpenLayers.Bounds(null, 21, 0, 32),162 position: new OpenLayers.Pixel(-1238, 0)163 },164 { //bottom-left165 size: new OpenLayers.Size('auto', 21),166 anchor: new OpenLayers.Bounds(0, 0, 22, null),167 position: new OpenLayers.Pixel(0, -629)168 },169 { //bottom-right170 size: new OpenLayers.Size(22, 21),171 anchor: new OpenLayers.Bounds(null, 0, 0, null),172 position: new OpenLayers.Pixel(-1238, -629)173 },174 { // stem175 size: new OpenLayers.Size(81, 33),176 anchor: new OpenLayers.Bounds(0, null, null, 0),177 position: new OpenLayers.Pixel(-311, -674)178 }179 ]180 }181 },182 /**183 * APIProperty: minSize184 * {<OpenLayers.Size>}185 */186 minSize: new OpenLayers.Size(105, 10),187 /**188 * APIProperty: maxSize189 * {<OpenLayers.Size>}190 */191 maxSize: new OpenLayers.Size(1200, 660),192 /** 193 * Constructor: OpenLayers.Popup.FramedCloud194 * 195 * Parameters:196 * id - {String}197 * lonlat - {<OpenLayers.LonLat>}198 * contentSize - {<OpenLayers.Size>}199 * contentHTML - {String}200 * anchor - {Object} Object to which we'll anchor the popup. Must expose 201 * a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 202 * (Note that this is generally an <OpenLayers.Icon>).203 * closeBox - {Boolean}204 * closeBoxCallback - {Function} Function to be called on closeBox click.205 */206 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 207 closeBoxCallback) {208 this.imageSrc = OpenLayers.Util.getImageLocation('cloud-popup-relative.png');209 OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments);210 this.contentDiv.className = this.contentDisplayClass;211 },212 CLASS_NAME: "OpenLayers.Popup.FramedCloud"...
test_webbrowser.py
Source:test_webbrowser.py
...33 popen_args.pop(popen_args.index(option))34 self.assertEqual(popen_args, arguments)35class GenericBrowserCommandTest(CommandTestMixin, unittest.TestCase):36 browser_class = webbrowser.GenericBrowser37 def test_open(self):38 self._test('open',39 options=[],40 arguments=[URL])41class BackgroundBrowserCommandTest(CommandTestMixin, unittest.TestCase):42 browser_class = webbrowser.BackgroundBrowser43 def test_open(self):44 self._test('open',45 options=[],46 arguments=[URL])47class ChromeCommandTest(CommandTestMixin, unittest.TestCase):48 browser_class = webbrowser.Chrome49 def test_open(self):50 self._test('open',51 options=[],52 arguments=[URL])53 def test_open_with_autoraise_false(self):54 self._test('open', kw=dict(autoraise=False),55 options=[],56 arguments=[URL])57 def test_open_new(self):58 self._test('open_new',59 options=['--new-window'],60 arguments=[URL])61 def test_open_new_tab(self):62 self._test('open_new_tab',63 options=[],64 arguments=[URL])65class MozillaCommandTest(CommandTestMixin, unittest.TestCase):66 browser_class = webbrowser.Mozilla67 def test_open(self):68 self._test('open',69 options=['-raise', '-remote'],70 arguments=['openURL({})'.format(URL)])71 def test_open_with_autoraise_false(self):72 self._test('open', kw=dict(autoraise=False),73 options=['-noraise', '-remote'],74 arguments=['openURL({})'.format(URL)])75 def test_open_new(self):76 self._test('open_new',77 options=['-raise', '-remote'],78 arguments=['openURL({},new-window)'.format(URL)])79 def test_open_new_tab(self):80 self._test('open_new_tab',81 options=['-raise', '-remote'],82 arguments=['openURL({},new-tab)'.format(URL)])83class GaleonCommandTest(CommandTestMixin, unittest.TestCase):84 browser_class = webbrowser.Galeon85 def test_open(self):86 self._test('open',87 options=['-n'],88 arguments=[URL])89 def test_open_with_autoraise_false(self):90 self._test('open', kw=dict(autoraise=False),91 options=['-noraise', '-n'],92 arguments=[URL])93 def test_open_new(self):94 self._test('open_new',95 options=['-w'],96 arguments=[URL])97 def test_open_new_tab(self):98 self._test('open_new_tab',99 options=['-w'],100 arguments=[URL])101class OperaCommandTest(CommandTestMixin, unittest.TestCase):102 browser_class = webbrowser.Opera103 def test_open(self):104 self._test('open',105 options=['-remote'],106 arguments=['openURL({})'.format(URL)])107 def test_open_with_autoraise_false(self):108 self._test('open', kw=dict(autoraise=False),109 options=['-remote', '-noraise'],110 arguments=['openURL({})'.format(URL)])111 def test_open_new(self):112 self._test('open_new',113 options=['-remote'],114 arguments=['openURL({},new-window)'.format(URL)])115 def test_open_new_tab(self):116 self._test('open_new_tab',117 options=['-remote'],118 arguments=['openURL({},new-page)'.format(URL)])119class ELinksCommandTest(CommandTestMixin, unittest.TestCase):120 browser_class = webbrowser.Elinks121 def test_open(self):122 self._test('open', options=['-remote'],123 arguments=['openURL({})'.format(URL)])124 def test_open_with_autoraise_false(self):125 self._test('open',126 options=['-remote'],127 arguments=['openURL({})'.format(URL)])128 def test_open_new(self):129 self._test('open_new',130 options=['-remote'],131 arguments=['openURL({},new-window)'.format(URL)])132 def test_open_new_tab(self):133 self._test('open_new_tab',134 options=['-remote'],135 arguments=['openURL({},new-tab)'.format(URL)])...
Main.js
Source:Main.js
1import React, { memo, useState, useEffect, useCallback } from "react";2import PropTypes from "prop-types";3import AOS from "aos/dist/aos";4import { withStyles } from "@material-ui/core";5import NavBar from "./navigation/NavBar";6import Footer from "./footer/Footer";7import "aos/dist/aos.css";8import CookieRulesDialog from "./cookies/CookieRulesDialog";9import CookieConsent from "./cookies/CookieConsent";10import dummyBlogPosts from "../dummy_data/blogPosts";11import DialogSelector from "./register_login/DialogSelector";12import Routing from "./Routing";13import smoothScrollTop from "../../shared/functions/smoothScrollTop";14AOS.init({ once: true });15const styles = (theme) => ({16 wrapper: {17 backgroundColor: theme.palette.common.white,18 overflowX: "hidden",19 },20});21function Main(props) {22 const { classes } = props;23 const [selectedTab, setSelectedTab] = useState(null);24 const [isMobileDrawerOpen, setIsMobileDrawerOpen] = useState(false);25 const [blogPosts, setBlogPosts] = useState([]);26 const [dialogOpen, setDialogOpen] = useState(null);27 const [isCookieRulesDialogOpen, setIsCookieRulesDialogOpen] = useState(false);28 const selectHome = useCallback(() => {29 smoothScrollTop();30 document.title =31 "WaVer - Free template for building a SaaS or admin application";32 setSelectedTab("Home");33 }, [setSelectedTab]);34 const selectBlog = useCallback(() => {35 smoothScrollTop();36 document.title = "WaVer - Blog";37 setSelectedTab("Blog");38 }, [setSelectedTab]);39 const openLoginDialog = useCallback(() => {40 setDialogOpen("login");41 setIsMobileDrawerOpen(false);42 }, [setDialogOpen, setIsMobileDrawerOpen]);43 const closeDialog = useCallback(() => {44 setDialogOpen(null);45 }, [setDialogOpen]);46 const openRegisterDialog = useCallback(() => {47 setDialogOpen("register");48 setIsMobileDrawerOpen(false);49 }, [setDialogOpen, setIsMobileDrawerOpen]);50 const openTermsDialog = useCallback(() => {51 setDialogOpen("termsOfService");52 }, [setDialogOpen]);53 const handleMobileDrawerOpen = useCallback(() => {54 setIsMobileDrawerOpen(true);55 }, [setIsMobileDrawerOpen]);56 const handleMobileDrawerClose = useCallback(() => {57 setIsMobileDrawerOpen(false);58 }, [setIsMobileDrawerOpen]);59 const openChangePasswordDialog = useCallback(() => {60 setDialogOpen("changePassword");61 }, [setDialogOpen]);62 const fetchBlogPosts = useCallback(() => {63 const blogPosts = dummyBlogPosts.map((blogPost) => {64 let title = blogPost.title;65 title = title.toLowerCase();66 /* Remove unwanted characters, only accept alphanumeric and space */67 title = title.replace(/[^A-Za-z0-9 ]/g, "");68 /* Replace multi spaces with a single space */69 title = title.replace(/\s{2,}/g, " ");70 /* Replace space with a '-' symbol */71 title = title.replace(/\s/g, "-");72 blogPost.url = `/blog/post/${title}`;73 blogPost.params = `?id=${blogPost.id}`;74 return blogPost;75 });76 setBlogPosts(blogPosts);77 }, [setBlogPosts]);78 const handleCookieRulesDialogOpen = useCallback(() => {79 setIsCookieRulesDialogOpen(true);80 }, [setIsCookieRulesDialogOpen]);81 const handleCookieRulesDialogClose = useCallback(() => {82 setIsCookieRulesDialogOpen(false);83 }, [setIsCookieRulesDialogOpen]);84 useEffect(fetchBlogPosts, [fetchBlogPosts]);85 return (86 <div className={classes.wrapper}>87 {!isCookieRulesDialogOpen && (88 <CookieConsent89 handleCookieRulesDialogOpen={handleCookieRulesDialogOpen}90 />91 )}92 <DialogSelector93 openLoginDialog={openLoginDialog}94 dialogOpen={dialogOpen}95 onClose={closeDialog}96 openTermsDialog={openTermsDialog}97 openRegisterDialog={openRegisterDialog}98 openChangePasswordDialog={openChangePasswordDialog}99 />100 <CookieRulesDialog101 open={isCookieRulesDialogOpen}102 onClose={handleCookieRulesDialogClose}103 />104 <NavBar105 selectedTab={selectedTab}106 selectTab={setSelectedTab}107 openLoginDialog={openLoginDialog}108 openRegisterDialog={openRegisterDialog}109 mobileDrawerOpen={isMobileDrawerOpen}110 handleMobileDrawerOpen={handleMobileDrawerOpen}111 handleMobileDrawerClose={handleMobileDrawerClose}112 />113 <Routing114 blogPosts={blogPosts}115 selectHome={selectHome}116 selectBlog={selectBlog}117 />118 <Footer />119 </div>120 );121}122Main.propTypes = {123 classes: PropTypes.object.isRequired,124};...
sdch.gyp
Source:sdch.gyp
1# Copyright (c) 2012 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4{5 'variables': {6 'chromium_code': 1,7 },8 'targets': [9 {10 'target_name': 'sdch',11 'type': 'static_library',12 'dependencies': [13 '../base/base.gyp:base',14 '../third_party/zlib/zlib.gyp:zlib',15 ],16 'sources': [17 'logging_forward.h',18 'open-vcdiff/src/addrcache.cc',19 'open-vcdiff/src/blockhash.cc',20 'open-vcdiff/src/blockhash.h',21 'open-vcdiff/src/checksum.h',22 'open-vcdiff/src/codetable.cc',23 'open-vcdiff/src/codetable.h',24 'open-vcdiff/src/compile_assert.h',25 'open-vcdiff/src/decodetable.cc',26 'open-vcdiff/src/decodetable.h',27 'open-vcdiff/src/encodetable.cc',28 'open-vcdiff/src/encodetable.h',29 'open-vcdiff/src/google/output_string.h',30 'open-vcdiff/src/google/vcdecoder.h',31 'open-vcdiff/src/google/vcencoder.h',32 'open-vcdiff/src/headerparser.cc',33 'open-vcdiff/src/headerparser.h',34 'open-vcdiff/src/instruction_map.cc',35 'open-vcdiff/src/instruction_map.h',36 'open-vcdiff/src/jsonwriter.h',37 'open-vcdiff/src/jsonwriter.cc',38 'open-vcdiff/src/rolling_hash.h',39 'open-vcdiff/src/testing.h',40 'open-vcdiff/src/varint_bigendian.cc',41 'open-vcdiff/src/varint_bigendian.h',42 'open-vcdiff/src/vcdecoder.cc',43 'open-vcdiff/src/vcencoder.cc',44 'open-vcdiff/src/vcdiff_defs.h',45 'open-vcdiff/src/vcdiffengine.cc',46 'open-vcdiff/src/vcdiffengine.h',47 'open-vcdiff/vsprojects/config.h',48 'open-vcdiff/vsprojects/stdint.h',49 ],50 'include_dirs': [51 'open-vcdiff/src',52 ],53 'direct_dependent_settings': {54 'include_dirs': [55 'open-vcdiff/src',56 ],57 },58 'conditions': [59 [ 'OS == "linux" or OS == "android"', { 'include_dirs': [ 'linux' ] } ],60 [ 'os_bsd==1 or OS=="solaris"', { 'include_dirs': [ 'bsd' ] } ],61 [ 'OS == "ios"', { 'include_dirs': [ 'ios' ] } ],62 [ 'OS == "mac"', {63 'include_dirs': [ 'mac' ],64 'defines': [ 'OPEN_VCDIFF_USE_AUTO_PTR' ],65 }],66 [ 'OS == "win"', { 'include_dirs': [ 'win' ] } ],67 ],68 # open-vcdiff's logging.h introduces static initializers. This was69 # reported upstream years ago (70 # https://github.com/google/open-vcdiff/issues/33 ). Since71 # upstream won't fix this, work around it on the chromium side:72 # Inject a header that forwards to base/logging.h instead (which doesn't73 # introduce static initializers, and which prevents open-vcdiff's74 # logging.h from being used).75 'variables': {76 'logging_path': 'logging_forward.h',77 'conditions': [78 # gyp leaves unspecified what the cwd is when running the compiler,79 # and gyp/linux doesn't have a built-in way for forcing an include.80 # So hardcode the base directory. If this spreads, provide native81 # support in gyp, like we have for gyp/mac and gyp/windows.82 # path.83 ['"<(GENERATOR)"=="ninja"', { 'logging_dir': '../..' },84 { 'logging_dir': '.' }85 ],86 ],87 },88 # GCC_PREFIX_HEADER is relative to the current directory,89 # ForcedIncludeFiles is relative to include_dirs, cflags relative to the90 # build directory.91 'xcode_settings': { 'GCC_PREFIX_HEADER': '<(logging_path)' },92 'msvs_settings': {93 'VCCLCompilerTool': {94 'ForcedIncludeFiles': [95 'sdch/<(logging_path)',96 ]97 }98 },99 'cflags': [100 '-include', '<(logging_dir)/sdch/<(logging_path)',101 # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:102 '-Wno-deprecated-declarations',103 ],104 },105 ],...
Using AI Code Generation
1import { open } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 it('should create the app', () => {5 const fixture = open(AppComponent);6 const app = fixture.componentInstance;7 expect(app).toBeTruthy();8 });9});
Using AI Code Generation
1import { open } from 'ng-mocks';2import { AppComponent } from './app.component';3import { AppModule } from './app.module';4describe('AppComponent', () => {5 it('should create the app', () => {6 const fixture = open(AppComponent, AppModule);7 const app = fixture.componentInstance;8 expect(app).toBeTruthy();9 });10});
Using AI Code Generation
1import { open } from 'ng-mocks';2describe('MyComponent', () => {3 let fixture: ComponentFixture<MyComponent>;4 let component: MyComponent;5 beforeEach(() => {6 TestBed.configureTestingModule({7 }).compileComponents();8 fixture = TestBed.createComponent(MyComponent);9 component = fixture.componentInstance;10 });11 it('should open a dialog', () => {12 open(MyDialogComponent, {13 inputs: {14 },15 });16 expect(component.openedDialog).toBeTruthy();17 });18});19@Component({20 template: 'Hello {{ name }}',21})22export class MyDialogComponent {23 @Input() name: string;24}25import { open } from 'ng-mocks';26describe('MyDialogComponent', () => {27 it('should be opened', () => {28 open(MyDialogComponent, {29 inputs: {30 },31 });32 expect(screen.getByText('Hello John')).toBeTruthy();33 });34});
Using AI Code Generation
1import { open } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 it('should create the app', () => {5 const fixture = open(AppComponent);6 const app = fixture.componentInstance;7 expect(app).toBeTruthy();8 });9});
Using AI Code Generation
1import { open } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 it('should open the dialog', () => {5 const fixture = open(AppComponent);6 expect(fixture.componentInstance).toBeTruthy();7 });8});
Using AI Code Generation
1ngMocks.open(MyComponent);2const myComponentInstance = ngMocks.findInstance(MyComponent);3const myComponentElement = ngMocks.find(MyComponent);4const myComponentElement = ngMocks.find(MyComponent, {5 predicate: (element) => element.nativeElement.id === 'my-id',6});7const myComponentElement = ngMocks.find(MyComponent, {8 predicate: (element) => element.nativeElement.id === 'my-id',9});10const myComponentElement = ngMocks.find(MyComponent, {11 predicate: (element) => element.nativeElement.id === 'my-id',12});13ngMocks.defaultMock(MyService, MyMockService);14ngMocks.defaultMock(MyService, MyMockService, {15 predicate: (service) => service.id === 'my-id',16});17ngMocks.defaultMock(MyService, MyMockService);18ngMocks.defaultMock(MyService, MyMockService, {19 predicate: (service) => service.id === 'my-id',20});21ngMocks.defaultMock(MyService, MyMockService);22ngMocks.defaultMock(MyService, MyMockService, {23 predicate: (service) => service.id === 'my-id',24});25ngMocks.defaultMock(MyService, MyMockService);26ngMocks.defaultMock(MyService, MyMockService, {27 predicate: (service) => service.id === 'my-id',28});29ngMocks.defaultMock(MyService, MyMockService);30ngMocks.defaultMock(MyService, MyMock
Using AI Code Generation
1import { open } from 'ng-mocks';2const fixture = open( MyComponent, {3 providers: [ { provide: MyService, useValue: myServiceMock } ],4 imports: [ MyModule ],5});6import { open } from 'ng-mocks';7const fixture = open( MyComponent, {8 providers: [ { provide: MyService, useValue: myServiceMock } ],9 imports: [ MyModule ],10});11import { open } from 'ng-mocks';12const fixture = open( MyComponent, {13 providers: [ { provide: MyService, useValue: myServiceMock } ],14 imports: [ MyModule ],15});16import { open } from 'ng-mocks';17const fixture = open( MyComponent, {18 providers: [ { provide: MyService, useValue: myServiceMock } ],19 imports: [ MyModule ],20});21import { open } from 'ng-mocks';22const fixture = open( MyComponent, {23 providers: [ { provide: MyService, useValue: myServiceMock } ],24 imports: [ MyModule ],25});26import { open } from 'ng-mocks';27const fixture = open( MyComponent, {28 providers: [ { provide: MyService, useValue: myServiceMock } ],29 imports: [ MyModule ],30});31import { open } from 'ng-mocks';32const fixture = open( MyComponent, {33 providers: [ { provide: MyService, useValue: myServiceMock } ],34 imports: [ MyModule ],35});36import {
Using AI Code Generation
1import {open} from 'ng-mocks';2open('my-component');3open('my-component', 'my-module');4open('my-component', 'my-module', {my: 'options'});5open('my-component', 'my-module', {my: 'options'}, {my: 'data'});6open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'});7open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'});8open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'}, {my: 'imports'});9open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'}, {my: 'imports'}, {my: 'providers'});10open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'}, {my: 'imports'}, {my: 'providers'}, {my: 'schemas'});11open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'}, {my: 'imports'}, {my: 'providers'}, {my: 'schemas'}, {my: 'entryComponents'});12open('my-component', 'my-module', {my: 'options'}, {my: 'data'}, {my: 'overrides'}, {my: 'declarations'}, {my: 'imports'}, {my: 'providers'}, {my: 'schemas'},
Using AI Code Generation
1const mock = ngMocks.default;2const fixture = mock.open(YourComponent);3const fixture = ngMocks.createComponent(YourComponent);4const mock = ngMocks.default;5const fixture = mock.open(YourComponent);6const fixture = ngMocks.createComponent(YourComponent);7const mock = ngMocks.default;8const fixture = mock.open(YourComponent);9const fixture = ngMocks.createComponent(YourComponent);10const mock = ngMocks.default;11const fixture = mock.open(YourComponent);12const fixture = ngMocks.createComponent(YourComponent);13const mock = ngMocks.default;14const fixture = mock.open(YourComponent);15const fixture = ngMocks.createComponent(YourComponent);16const mock = ngMocks.default;17const fixture = mock.open(YourComponent);18const fixture = ngMocks.createComponent(YourComponent);19const mock = ngMocks.default;20const fixture = mock.open(YourComponent);21const fixture = ngMocks.createComponent(YourComponent);22const mock = ngMocks.default;23const fixture = mock.open(YourComponent);24const fixture = ngMocks.createComponent(YourComponent);25const mock = ngMocks.default;26const fixture = mock.open(YourComponent);27const fixture = ngMocks.createComponent(YourComponent);
Using AI Code Generation
1it('should open the dialog', () => {2 const openSpy = spyOn(MatDialog, 'open');3 component.openDialog();4 expect(openSpy).toHaveBeenCalled();5});6import { mock } from 'ng-mocks';7import { MatDialog } from '@angular/material/dialog';8beforeEach(() => {9 TestBed.configureTestingModule({10 imports: [MatDialogModule],11 { provide: MatDialog, useValue: mock(MatDialog) }12 });13});14it('should get the data', () => {15 const getDataSpy = spyOn(TestService, 'getData').and.returnValue(of('Data'));16 component.getData();17 expect(getDataSpy).toHaveBeenCalled();18});19import { mock } from 'ng-mocks';20import { TestService } from './test.service';21beforeEach(() => {22 TestBed.configureTestingModule({23 imports: [TestService],24 { provide: TestService, useValue: mock(TestService) }25 });26});
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!