How to use showVersions method in Cypress

Best JavaScript code snippet using cypress

bucket-objects-table.js

Source:bucket-objects-table.js Github

copy

Full Screen

...180 );181 this.baseRoute = baseRoute;182 this.filter(filter);183 this.stateFilter(stateFilter);184 this.showVersions(showVersions);185 this.sorting({ sortBy, order });186 this.page(page);187 this.pageSize(pageSize);188 this.selectedForDelete(selectedForDelete);189 action$.next(fetchObjects(190 this.viewName,191 {192 bucket: bucket,193 filter,194 sortBy,195 order,196 skip: page * pageSize,197 limit: pageSize,198 stateFilter,199 versions: showVersions200 },201 location.hostname202 ));203 }204 onState([bucket, bucketObjects, user, accounts, sslCert]) {205 const queryKey = bucketObjects.views[this.viewName];206 const query = bucketObjects.queries[queryKey];207 if (!query || !query.result || !bucket || !user || !accounts) {208 this.uploadButton({});209 this.objectsLoaded(false);210 this.rows([]);211 return;212 }213 const isVersionedBucket = bucket.versioning.mode !== 'DISABLED';214 const showVersionColumn =215 isVersionedBucket &&216 this.showVersions() &&217 this.stateFilter() !== 'UPLOADING';218 const visibleColumns = this.columns.map(col => col.name)219 .filter(name => showVersionColumn || name !== 'versionId');220 const account = accounts[user];221 const { counters, items: queryObjects, emptyReason } = query.result;222 const s3Connection = {223 accessKey: account.accessKeys.accessKey,224 secretKey: account.accessKeys.secretKey,225 endpoint: location.hostname226 };227 const rowParams = {228 baseRoute: this.baseRoute,229 onSelectForDelete: this.onSelectForDelete.bind(this),230 onDelete: this.onDeleteBucketObject.bind(this)231 };232 const modeFilterOptions = _getStateFilterOptions(counters);233 const httpsNoCert = location.protocol === 'https' && !sslCert;234 const isReadOnly = !isBucketWritable(bucket);235 const uploadButton = {236 visible: false, // WE may renable this when we fix the cert issues.237 disabled: !account.isOwner || isReadOnly || httpsNoCert,238 tooltip: _getUploadTooltip(account.isOwner, isReadOnly, httpsNoCert)239 };240 const rows = queryObjects241 .map((bucketObjectKey, i) => {242 const row = this.rows.get(i) || new ObjectRowViewModel(rowParams);243 const obj = bucketObjects.items[bucketObjectKey];244 row.onState(245 bucketObjectKey,246 obj,247 !account.isOwner,248 isVersionedBucket,249 this.showVersions(),250 this.selectedForDelete()251 );252 return row;253 });254 this.isShowVersionsVisible(isVersionedBucket);255 this.visibleColumns(visibleColumns);256 this.s3Connection = s3Connection;257 this.stateFilterOptions(modeFilterOptions);258 this.fileSelectorExpanded(false);259 this.uploadButton(uploadButton);260 this.pathname = location.pathname;261 this.objectCount(_getItemsCountByState(counters, this.stateFilter()));262 this.rows(rows);263 this.emptyMessage(emptyMessages[emptyReason]);264 this.objectsLoaded(true);265 }266 onFilter(filter) {267 this._query({268 filter: filter,269 page: 0,270 selectedForDelete: null271 });272 }273 onFilterByState(state) {274 this._query({275 stateFilter: state,276 page: 0,277 selectedForDelete: null278 });279 }280 onShowVersions(state) {281 this._query({282 showVersions: state,283 page: 0,284 selectedForDelete: null285 });286 }287 onSort(sorting) {288 this._query({289 sorting,290 page: 0,291 selectedForDelete: null292 });293 }294 onPage(page) {295 this._query({296 page,297 selectedForDelete: null298 });299 }300 onPageSize(pageSize) {301 this._query({302 pageSize,303 page: 0,304 selectedForDelete: null305 });306 }307 _query(params) {308 const {309 filter = this.filter(),310 sorting = this.sorting(),311 page = this.page(),312 pageSize = this.pageSize(),313 selectedForDelete = this.selectedForDelete(),314 stateFilter = this.stateFilter(),315 showVersions = this.showVersions()316 } = params;317 const { sortBy, order } = sorting;318 const query = {319 filter: filter || undefined,320 sortBy: sortBy,321 order: order,322 page: page || undefined,323 pageSize,324 selectedForDelete: selectedForDelete || undefined,325 stateFilter: stateFilter,326 showVersions: showVersions || undefined327 };328 action$.next(requestLocation(329 realizeUri(this.pathname, {}, query)330 ));331 }332 onSelectForDelete(selected) {333 this._query({ selectedForDelete: selected });334 }335 onDeleteBucketObject(id) {336 const objId = this.showVersions() ?337 splitObjectId(id) :338 pick(splitObjectId(id), ['bucket', 'key', 'uploadId']);339 action$.next(deleteObject(objId, this.s3Connection));340 }341 uploadFiles(files) {342 action$.next(uploadObjects(ko.unwrap(this.bucketName), files, this.s3Connection));343 this.fileSelectorExpanded(false);344 }345 dispose() {346 action$.next(dropObjectsView(this.viewName));347 super.dispose();348 }349}350export default {...

Full Screen

Full Screen

microserviceMindmap.js

Source:microserviceMindmap.js Github

copy

Full Screen

1import React from 'react';2import { connect } from 'react-redux';3import MicroserviceMindmapContextMenu from './microserviceMindmapContextMenu';4import MicroserviceCountLabel from './microserviceCountLabel';5import MicroserviceDocumentationLink from './microserviceDocumentationLink';6import StageSelector from './stageSelector';7import { onAddLink, onContextMenuOpen, onSelectMicroserviceNode } from './../actions/microserviceMindmapActions';8import { shouldFilterOut } from './../shared/filterUtils';9import { hasAllRequiredProperties } from './../shared/requiredPropertyUtil';10const mapStateToProps = (state) => {11 return {12 microservices: state.microservices,13 menuMode: state.menuMode,14 filterString: state.filterString,15 microserviceListResizeCount: state.microserviceListResizeCount,16 debugMode: state.debugMode,17 showVersions: state.showVersions,18 stage: state.stage19 };20};21const mapDispatchToProps = {22 onSelectMicroserviceNode,23 onContextMenuOpen,24 onAddLink25};26const _colors = {27 'MICROSERVICE': {28 background: "#bef24d",29 border: "#19c786"30 },31 'EXTERNAL': {32 background: "#f2d12d",33 border: "#f69805"34 },35 'GREY': {36 background: "#f0f0f0",37 border: "#c4c3c6"38 }39};40export class MicroserviceMindmap extends React.Component {41 onContextMenuHandler(params) {42 params.event.preventDefault();43 const nodeId = this._network.getNodeAt(params.pointer.DOM);44 let edgeFromId, edgeToId;45 if (nodeId) {46 // right click does not select node!47 this._network.selectNodes([nodeId]);48 // network.selectNodes(...) does _not_ fire events!49 this.onSelectMicroserviceNodeHandler({ nodes: [nodeId] });50 } else {51 this._network.unselectAll();52 const edgeId = this._network.getEdgeAt(params.pointer.DOM);53 if (edgeId) {54 const edgeFromToIds = this._network.getConnectedNodes(edgeId);55 edgeFromId = edgeFromToIds[0];56 edgeToId = edgeFromToIds[1];57 }58 }59 this.props.onContextMenuOpen({60 top: params.event.clientY,61 left: params.event.clientX,62 nodeId: nodeId,63 edgeFromId: edgeFromId,64 edgeToId: edgeToId65 });66 }67 onClickHandler(options) {68 if (options.event.srcEvent.ctrlKey) {69 // macbook touchpad right-click using ctrl key?70 return;71 }72 this.props.onContextMenuOpen({73 top: -1,74 left: -1,75 nodeId: undefined76 });77 }78 onAddLinkHandler(edgeData, callback) {79 callback(edgeData);80 this.props.onAddLink(edgeData);81 }82 onSelectMicroserviceNodeHandler(params) {83 this.props.onSelectMicroserviceNode({ nodes: params.nodes, stage: this.props.stage });84 }85 componentDidMount() {86 this.updateMindmap();87 window.addEventListener("resize", this._resize.bind(this));88 }89 _resize() {90 if (this._network && this.refs.microserviceMindmap) {91 this._network.setSize("100%", (this.refs.microserviceMindmap.offsetHeight - 4) + "px");92 this._network.redraw();93 }94 }95 _filterChanged(filterString, nextFilterString) {96 return filterString !== nextFilterString;97 }98 _showVersionsChanged(showVersions, nextShowVersions) {99 return (showVersions !== nextShowVersions)100 }101 shouldComponentUpdate(nextProps) {102 if (nextProps.microserviceListResizeCount !== this.props.microserviceListResizeCount) {103 // service list was resized, no need to re-draw the graph itself104 this._resize();105 return false;106 } else if (this._filterChanged(this.props.filterString, nextProps.filterString)107 || this._showVersionsChanged(this.props.showVersions, nextProps.showVersions)) {108 // we are filtering or changing showVersions, no need to re-draw the graph itself109 let microservices = this.props.microservices.map(microservice => this._addColorData(microservice, nextProps));110 if (nextProps.showVersions) {111 microservices = microservices.map(microservice => this._addVersionData(microservice));112 }113 this._network.body.data.nodes.update(microservices);114 return false;115 } else if (nextProps.menuMode === 'ADD_LINK') {116 // we adding a connection between services, no need to re-draw the graph itself117 this._network.addEdgeMode();118 return false;119 } else if (this.props.menuMode === 'ADD_LINK' && !nextProps.menuMode) {120 // we just added a connection between services, no need to re-draw the graph itself121 this._network.disableEditMode();122 return false;123 }124 return true;125 }126 componentDidUpdate() {127 this.updateMindmap();128 }129 _addColorData(microservice, props) {130 let coloredMicroservice = Object.assign({}, microservice);131 if (shouldFilterOut(coloredMicroservice, props.filterString)) {132 coloredMicroservice.group = "filteredOut";133 if (!hasAllRequiredProperties(coloredMicroservice, props.serviceRequiredProperties)) {134 coloredMicroservice.shadow = {135 color: "#c4c3c6"136 }137 }138 } else {139 if (coloredMicroservice.external) {140 coloredMicroservice.group = "external";141 } else {142 coloredMicroservice.group = "microservice";143 }144 if (!hasAllRequiredProperties(coloredMicroservice, props.serviceRequiredProperties)) {145 coloredMicroservice.shadow = {146 color: "#e50f03"147 }148 }149 }150 return coloredMicroservice;151 }152 _addVersionData(microservice) {153 let microserviceWithVersion = Object.assign({}, microservice);154 if (microserviceWithVersion.version && !microserviceWithVersion.label.includes('@')) {155 microserviceWithVersion.label = microserviceWithVersion.label + '@' + microserviceWithVersion.version;156 }157 return microserviceWithVersion;158 }159 updateMindmap() {160 let microservices = this.props.microservices.map(microservice => this._addColorData(microservice, this.props))161 if (this.props.showVersions) {162 microservices = microservices.map(microservice => this._addVersionData(microservice));163 }164 // create an array with nodes165 let nodes = new vis.DataSet(microservices);166 // create a network167 let data = {168 nodes: nodes169 };170 if (!this._network) {171 let options = {172 autoResize: false,173 nodes: {174 borderWidth: 2,175 shape: "box"176 },177 edges: {178 width: 2,179 arrows: "to"180 },181 groups: {182 "microservice": {183 color: _colors.MICROSERVICE,184 font: { color: "#000000" }185 },186 "external": {187 color: _colors.EXTERNAL,188 font: { color: "#000000" }189 },190 "filteredOut": {191 color: _colors.GREY,192 font: { color: "#c4c3c6" }193 }194 },195 layout: {196 randomSeed: 2197 },198 manipulation: {199 enabled: false,200 addEdge: this.onAddLinkHandler.bind(this)201 },202 physics: {203 barnesHut: {204 // how much are nodes allowed to overlap? 1 = maximum, 0 = minimum distance205 avoidOverlap: 0.8,206 // damping slows things down, keeps nodes from floating away, 1 = maximum, 0 = minimum207 damping: 0.7208 },209 // speed at which simulation stops. the lower the value, the longer the nodes keep floating around210 minVelocity: 2.5211 }212 };213 if (this.props.debugMode) {214 options.configure = {215 enabled: true,216 container: this.refs.debugcontainer217 }218 }219 this._network = new vis.Network(this.refs.vizcontainer, data, options);220 let boundOnSelectMicroserviceNode = this.onSelectMicroserviceNodeHandler.bind(this);221 let boundOnContextMenuOpen = this.onContextMenuHandler.bind(this);222 let boundOnClick = this.onClickHandler.bind(this);223 this._network.on("selectNode", boundOnSelectMicroserviceNode);224 this._network.on("oncontext", boundOnContextMenuOpen);225 this._network.on("click", boundOnClick);226 this._network.on("select", boundOnClick);227 this._network.on("dragStart", boundOnClick);228 } else {229 this._network.setData(data);230 this._resize();231 }232 // add edges to existing network (a lot faster than adding them with the node data)233 microservices.filter(function (el) {234 return el.consumes;235 }).forEach(function (el) {236 el.consumes.forEach(function (consumer) {237 this._network.body.data.edges.add({238 from: el.id,239 to: consumer.target,240 label: consumer.type !== null ? consumer.type : "",241 font: { align: 'middle' }242 });243 }, this);244 }, this);245 // because we add the edges to an existing network, things are kind of tangled up, so we start a simulation manually (to un-tangle everything)246 this._network.startSimulation();247 }248 render() {249 return (250 <div className="microserviceMindmap" ref="microserviceMindmap">251 <MicroserviceMindmapContextMenu/>252 {this.props.debugMode && <div ref="debugcontainer" className="debugContainer"/>}253 <div ref="vizcontainer" className="vizContainer"/>254 <StageSelector/>255 <MicroserviceCountLabel serviceRequiredProperties={this.props.serviceRequiredProperties}/>256 <MicroserviceDocumentationLink />257 </div>258 );259 }260}261MicroserviceMindmap._network = undefined;...

Full Screen

Full Screen

Version.js

Source:Version.js Github

copy

Full Screen

1import React, { Component } from 'react'2import PropTypes from 'prop-types'3import ls from 'local-storage'4class Version extends Component {5 constructor(props) {6 super(props)7 this.state = {8 after: '',9 before: '',10 showVersions: false11 }12 this.handleshowVersionsChange = this.handleshowVersionsChange.bind(this)13 this.handleAfterChange = this.handleAfterChange.bind(this)14 this.handleBeforeChange = this.handleBeforeChange.bind(this)15 this.handleApply = this.handleApply.bind(this)16 }17 componentDidMount() {18 let showVersions = ls.get('showVersions')19 if (showVersions === null) {20 showVersions = false21 }22 this.setState({ showVersions })23 }24 componentDidUpdate(prevProps) {25 if (this.props.params.after !== prevProps.params.after || this.props.params.before !== prevProps.params.before) {26 const after = this.props.params.after || ''27 const before = this.props.params.before || ''28 this.setState({ after, before })29 }30 }31 handleshowVersionsChange(showVersions) {32 const { onChange } = this.props33 if (showVersions === false) {34 onChange({35 after: false,36 before: false37 })38 }39 ls.set('showVersions', showVersions)40 this.setState({ showVersions })41 }42 handleAfterChange(e) {43 this.setState({ after: e.target.value })44 }45 handleBeforeChange(e) {46 this.setState({ before: e.target.value })47 }48 handleApply() {49 const { onChange } = this.props50 const { after, before } = this.state51 onChange({52 after: after || false,53 before: before || false54 })55 }56 render() {57 const { params, onChange } = this.props58 const { after, before, showVersions } = this.state59 const allChecked = params.all === 'true' || false60 return (61 <div className="card version">62 <div className="card-header d-md-flex">63 <div className="form-check form-check-inline mb-2 mb-md-0">64 <input className="form-check-input" type="radio" id="latest-version-radio"65 checked={!showVersions} onChange={e => this.handleshowVersionsChange(false)} />66 <label className="form-check-label" htmlFor="latest-version-radio">67 Show only the latest version68 </label>69 </div>70 <div className="form-check form-check-inline mb-2 mb-md-0">71 <input className="form-check-input" type="radio" id="specific-versions-radio"72 checked={showVersions} onChange={e => this.handleshowVersionsChange(true)} />73 <label className="form-check-label" htmlFor="specific-versions-radio">74 Show specific versions with date constraints75 </label>76 </div>77 <div className="form-check form-check-inline ml-auto mr-0">78 <input className="form-check-input" type="checkbox" id="archived-versions-checkbox"79 checked={allChecked} onChange={e => onChange({ all: !allChecked})} />80 <label className="form-check-label" htmlFor="archived-versions-checkbox">Show archived files</label>81 </div>82 </div>83 {showVersions &&84 <ul className="list-group list-group-flush">85 <li className="list-group-item">86 <div className="row align-items-center">87 <div className="col-12 col-md-auto mb-2 mb-md-0">88 <label className="form-check-label">Version range:</label>89 </div>90 <div className="col-12 col-md mb-2 mb-md-0">91 <input type="text" className="form-control form-control-sm" placeholder="After YYYMMDD" value={after}92 onChange={this.handleAfterChange} />93 </div>94 <div className="col-12 col-md-auto mb-2 mb-md-0">95 <label className="form-check-label">≤ Dataset version ≤</label>96 </div>97 <div className="col-12 col-md mb-2 mb-md-0">98 <input type="text" className="form-control form-control-sm" placeholder="Before YYYMMDD" value={before}99 onChange={this.handleBeforeChange} />100 </div>101 <div className="col-12 col-md-auto">102 <button className="btn btn-default btn-sm" onClick={this.handleApply}>Apply range</button>103 </div>104 </div>105 </li>106 </ul>107 }108 </div>109 )110 }111}112Version.propTypes = {113 params: PropTypes.object.isRequired,114 onChange: PropTypes.func.isRequired115}...

Full Screen

Full Screen

Textarea.js

Source:Textarea.js Github

copy

Full Screen

...43 field: self.field44 }).placeAt(self.textareaContainer);45 46 if (self.displayVersions){47 self.showVersions();48 //refresh the timeago49 self.interval = setInterval(dojo.hitch(self, self._refresh), 60000);50 51 }52 53 dojo.connect(this.showAllVersions, "onclick", this, function(){54 this.showAll = true;55 this.showVersions();56 });57 58 dojo.connect(this.showRecentVersions, "onclick", this, function(){59 this.showAll = false;60 this.showVersions();61 }); 62 63 },64 65 setDisabled: function(){66 this.inherited(arguments);67 68 dojo.removeClass(this.textarea.focusNode, "display-version");69 dojo.addClass(this.versionsContainer, "hidden");70 71 this.textarea.set("disabled", true);72 //use this function for dispay type views. It will disable the field if there is a value73 //or is will add a not started node74 fModel.field = this.field;75 if (!fModel.hasValue()){76 this.domNode.innerHTML = '<div class="c-border dijitTextAreaDisabled not-started">' + coordel.notStarted + '</div>';77 }78 },79 80 showVersions: function(){81 fModel.field = this.field;82 if (fModel.hasVersions()){83 //add the class to shrink the size of the text box to 75% and show the versions84 dojo.addClass(this.textarea.focusNode, "display-version");85 dojo.removeClass(this.versionsContainer, "hidden");86 if (!this.showAll){87 dojo.addClass(this.allTitle, "hidden");88 dojo.removeClass(this.recentTitle, "hidden");89 this._createVersions(fModel.recentVersions());90 } else {91 dojo.removeClass(this.allTitle, "hidden");92 dojo.addClass(this.recentTitle, "hidden");93 this._createVersions(fModel.allVersions());94 }95 96 } else {97 //remove shrinking the text box and hide the versions98 dojo.removeClass(this.textarea.focusNode, "display-version");99 dojo.addClass(this.versionsContainer, "hidden");100 }101 },102 103 _refresh: function(){104 this.showVersions();105 },106 107 _createVersions: function(versions){108 109 fModel.field = this.field;110 111 dojo.forEach(dijit.findWidgets(dojo.byId(this.versions)), function(w) {112 w.destroyRecursive();113 });114 115 var count = fModel.allVersions().length;116 117 dojo.forEach(versions, function(version){118 var ver = new TextVersion({...

Full Screen

Full Screen

DetailsVersion.js

Source:DetailsVersion.js Github

copy

Full Screen

1/* JavaScript content from js/appcenter/views/DetailsVersion.js in folder common */2/*3 * Licensed Materials - Property of IBM4 * 5725-I43 (C) Copyright IBM Corp. 2011, 2014. All Rights Reserved.5 * US Government Users Restricted Rights - Use, duplication or6 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.7 */8define([9 "dojo/_base/declare",10 "dojo/_base/lang", 11 "dojo/_base/array",12 "dojo/on", 13 "dojo/string", 14 "dojo/dom-style",15 "dojo/dom-class",16 "dojo/sniff",17 "dojo/topic",18 "appcenter/views/DetailsBase",19 "appcenter/views/utils"], 20 function(21 declare,22 lang,23 arr,24 on,25 string,26 domStyle,27 domClass,28 has,29 topic,30 DetailsBase,31 utils){32 return declare("appcenter.views.DetailsVersion", DetailsBase, {33 34 init: function(){35 36 this.inherited(arguments);37 38 if(this.versionHistoryItem){39 this.versionHistoryItem.on("click", lang.hitch(this, function(e){ 40 this.app.emit("appcenter/showVersionHistory");41 }));42 }43 this.reviewsListItem.on("click", lang.hitch(this, function(e){44 this.app.emit("appcenter/showReviews");45 }));46 this.rateAppListItem.on("click", lang.hitch(this, function(e){47 if(this.appItem.isAppLink || has("ios")){48 this.app.emit("appcenter/rateApplication"); 49 }else{50 this.app.getInstalledVersion(this.appItem).then(51 lang.hitch(this, function(iVersion){52 if(iVersion){53 this.app.emit("appcenter/rateApplication");54 }55 })56 ); 57 }58 }));59 60 topic.subscribe("appcenter/reviewSent", lang.hitch(this, function(e){61 if(e.appItem.isAppLink == this.detailsAppLink){62 if(this.versionItem){63 this.app.invalidateAppInfo(this.versionItem);64 }65 this.reviewsInvalidated = true;66 }67 }));68 69 },70 71 detailsAppLink: false,72 onAppInfoLoaded: function(vItem){73 74 this.app.ios7ScrollWA(this.container);75 76 this.reviewsInvalidated = false;77 this.updateDetails();78 this.updateDescription(); 79 this.updateInstallButton();80 this.updateListItems(); 81 82 },83 onNativeUpdate: function(){84 85 this.app.ios7ScrollWA(this.container);86 87 this.updateInstallButton();88 this.updateListItems(); 89 },90 91 updateListItems: function(reset){92 if(reset){93 if(this.versionHistoryItem){94 domStyle.hide(this.versionHistoryItem);95 }96 domStyle.hide(this.rateAppListItem);97 domStyle.hide(this.reviewsListItem);98 return;99 }100 101 if(!this.appItem.isAppLink){ 102 if(has("ios")){103 104 var showVersions = this.appItem.versions && this.appItem.versions.length > 1 && this.app.appConfig.showPreviousVersions;105 106 this.rateAppListItem.set("label", this.nls.addReviewButton);107 domStyle.setD(this.versionHistoryItem, showVersions ? "block" : "none");108 domStyle.setD(this.rateAppListItem, "block");109 domStyle.setD(this.reviewsListItem, this.appItem.nb_rating_all_versions > 0 ? "block" : "none");110 111 } else {112 113 this.app.getInstalledVersion(this.appItem).then(114 lang.hitch(this, function(iVersion){115 if(iVersion && iVersion.version == this.versionItem.version){116 this.rateAppListItem.set("label", string.substitute(this.nls.rateInstalled, {version: this.app.getVersionName(iVersion)}));117 }else{118 this.rateAppListItem.set("label", this.nls.rateInstalledDisabled);119 }120 121 domClass[iVersion==null?"add":"remove"](this.rateAppListItem.domNode, "mblDisabled");122 var showVersions = this.appItem.versions && this.appItem.versions.length > 1 && this.app.appConfig.showPreviousVersions;123 124 domStyle.setD(this.versionHistoryItem, showVersions ? "block" : "none");125 domStyle.setD(this.rateAppListItem, "block");126 domStyle.setD(this.reviewsListItem, this.appItem.nb_rating_all_versions > 0 ? "block" : "none");127 }),128 this.app.getErrHandler()129 );130 }131 }132 133 },134 135 afterDeactivate: function(){ 136 this.container.scrollTo(0);137 } 138 });...

Full Screen

Full Screen

lively-version-control.js

Source:lively-version-control.js Github

copy

Full Screen

...4 initialize() {5 6 }7 8 showVersions(url) {9 this.url= url10 var listNode = this.shadowRoot.querySelector("#list")11 fetch(url, {12 method: "OPTIONS",13 headers: {14 showversions: true15 }16 }).then(r => r.text()).then( text => {17 try {18 var json = JSON.parse(text);19 } catch(e) {20 lively.notify("[version control] could not parse " + url+"versions:" + e, text.slice(0,1000), 10, () => {21 lively.openWorkspace(text);22 }, "red");23 return 24 }25 if (!json.versions) {26 lively.notify("[version control] no versions found", text)27 return28 }29 listNode.innerHTML =""30 json.versions.forEach( ea => {31 if (!ea) return // guard for syntax fixing null in server.. 32 var item = document.createElement("tr")33 item.innerHTML = "<td class='date'>" + moment(ea.date).format("YYYY-MM-DD hh:mm") + "</td><td>"+ ea.author + "</td><td>" + ea.comment + "</td>"34 listNode.appendChild(item)35 ea.toString = function() { return JSON.stringify(this)} // generic pretty print36 item.value = ea37 item.onclick = () => {38 this.selectItem(item)39 }40 }) 41 })42 }43 44 selectItem(item) {45 if (this.selectedItem) 46 this.selectedItem.classList.remove("selected");47 if (this.selectedItem !== item) { 48 this.selectedItem = item;49 this.selectedItem.classList.add("selected");50 this.selection = item.value;51 fetch(this.url, {52 headers: {53 fileversion: item.value.version54 }55 }).then( r => r.text()).then( text => {56 if (this.editor && this.editor.mergeView) {57 this.editor.mergeView(text) 58 }59 // this.get("#preview").editor.setValue(text)60 })61 62 63 } else {64 this.selectedItem = null;65 this.selection = null66 }67 }68 livelyExample() {69 this.showVersions(lively4url + "/README.md")70 }71 72 73 livelyMigrate(obj) {74 this.showVersions(obj.url);75 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import React from "react";2import PropTypes from "prop-types";3import { IconButton, FlexBlock } from "../../atoms";4import {5 StyledFlexBlock,6 StyledBlockWrapper,7 StyledWrapper,8} from "./styles";9import CrossIcon from "../../../assets/images/icons/chatbox/cross.svg";10import {11 LUP_SPACING_1212} from "../../../theme";13const ChatHeader = ({14 headerText,15 suffix,16 showCloseIcon,17 onClose,18 showVersions,19}) => {20 return (21 <StyledWrapper>22 <StyledBlockWrapper>23 <StyledFlexBlock>{headerText}</StyledFlexBlock>24 {showVersions && (25 <FlexBlock26 style={{27 flexGrow: "1",28 borderBottom: "none",29 justifyContent: "flex-start",30 padding: "0px",31 margin: "0px",32 }}33 >34 {suffix}35 </FlexBlock>36 )}37 </StyledBlockWrapper>38 <StyledBlockWrapper>39 <FlexBlock40 style={{ borderBottom: "none", padding: "0px", margin: "0px" }}41 >42 {showCloseIcon ? (43 <IconButton src={CrossIcon} onClick={onClose} size={LUP_SPACING_12}></IconButton>44 ) : null}45 </FlexBlock>46 </StyledBlockWrapper>47 </StyledWrapper>48 );49};50ChatHeader.propTypes = {51 onClose: PropTypes.func,52 headerText: PropTypes.string,53 showCloseIcon: PropTypes.bool,54 suffix: PropTypes.node,55 showVersions: PropTypes.bool,56};57ChatHeader.defaultProps = {58 headerText: "Comments",59 onClose: () => {},60 suffix: "",61 showCloseIcon: false,62 showVersions: false,63};...

Full Screen

Full Screen

docController.js

Source:docController.js Github

copy

Full Screen

1'use strict';2angular.module('myApp.home').controller('DocCtrl', function($scope, $http) {3 $scope.docs = docsArray;4 $scope.doc = {};5 $scope.active = false;6 $scope.toUpdate = false;7 $scope.selectedRow = null;8 $scope.sortType = 'name';9 $scope.sortReverse = false;10 $scope.searchItem = "";11 $scope.showVersions = false;12 $scope.reset = function(){13 $scope.doc = {};14 $scope.active = false;15 $scope.toUpdate = false;16 $scope.selectedRow = null;17 $scope.showVersions = false;18 }19 $scope.setSelectedStatus = function(docSelected, index){20 if($scope.doc == docSelected){21 //for unselect22 $scope.reset();23 }24 else{25 //for select26 $scope.doc = docSelected;27 $scope.selectedRow = index;28 $scope.toUpdate = true;29 $scope.showVersions = false;30 }31 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', () => {2 it('Does not do much!', () => {3 cy.showVersions()4 })5})6Cypress.Commands.add('showVersions', () => {7 cy.log(Cypress.version)8 cy.log(Cypress.config())9})10describe('My First Test', () => {11 it('Does not do much!', () => {12 cy.showVersions()13 })14})15Cypress.Commands.add('showVersions', () => {16 cy.log(Cypress.version)17 cy.log(Cypress.config())18})19describe('My First Test', () => {20 it('Does not do much!', () => {21 cy.showVersions()22 })23})24Cypress.Commands.add('showVersions', () => {25 cy.log(Cypress.version)26 cy.log(Cypress.config())27})28describe('My First Test', () => {29 it('Does not do much!', () => {30 cy.showVersions()31 })32})33Cypress.Commands.add('showVersions', () => {34 cy.log(Cypress.version)35 cy.log(Cypress.config())36})37describe('My First Test', () => {38 it('Does not do much!', () => {39 cy.showVersions()40 })41})42Cypress.Commands.add('showVersions', () => {43 cy.log(Cypress.version)44 cy.log(Cypress.config())

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.showVersions();2Cypress.Commands.add('showVersions', () => {3 console.log('Cypress Version: ' + Cypress.version);4 console.log('Cypress Chrome Version: ' + Cypress.env('chromeVersion'));5 console.log('Cypress Electron Version: ' + Cypress.env('electronVersion'));6 console.log('Cypress Firefox Version: ' + Cypress.env('firefoxVersion'));7});8module.exports = (on, config) => {9 on('before:browser:launch', (browser, launchOptions) => {10 if (browser.name === 'chrome') {11 launchOptions.args.push('--disable-dev-shm-usage');12 config.env.chromeVersion = browser.majorVersion;13 }14 if (browser.name === 'electron') {15 config.env.electronVersion = browser.majorVersion;16 }17 if (browser.name === 'firefox') {18 config.env.firefoxVersion = browser.majorVersion;19 }20 return launchOptions;21 });22};23{24}25{26 "devDependencies": {27 }28}29module.exports = (on, config) => {30 require('cypress-versions/plugin')(on, config);31 return config;32}

Full Screen

Using AI Code Generation

copy

Full Screen

1const cypress = require('cypress')2cypress.run().then((results) => {3 console.log(results)4 cypress.showVersions()5})6const cypress = require('cypress')7cypress.showVersions()8{9}10{11 "devDependencies": {12 }13}14{15 "packages": {16 "": {17 },18 "node_modules/cypress": {19 }20 }21}

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Cypress versions', () => {2 it('should display versions', () => {3 cy.showVersions();4 });5});6cypress:cli:cli parsed cli options {} +4ms7cypress:cli:cli opening from options {} +0ms8cypress:cli:cli opening with environment {} +1ms9cypress:cli:cli parsed cli options {} +1ms10cypress:cli:cli opening from options {} +0ms11cypress:cli:cli opening with environment {} +0ms12cypress:cli:cli run called with options {} +0ms13cypress:cli:cli { verified:

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.showVersions()2Cypress.showVersions()3Cypress.showVersions()4Cypress.showVersions()5Cypress.showVersions()6Cypress.showVersions()7Cypress.showVersions()8Cypress.Commands.add('showVersions', () => {9 cy.log('Cypress version: ' + Cypress.version)10 cy.log('Browser name: ' + Cypress.browser.name)11 cy.log('Browser version: ' + Cypress.browser.version)12})13Cypress.showVersions()14cy.url().then((url) => {15 cy.log('Current URL is: ' + url)16})

Full Screen

Using AI Code Generation

copy

Full Screen

1import { showVersions } from 'cypress-versions'2{3}4module.exports = (on, config) => {5 require('cypress-versions/plugin')(on, config)6}7import { showVersions } from 'cypress-versions'8{9}10module.exports = (on, config) => {11 require('cypress-versions/plugin')(on, config)12}13import { showVersions } from 'cypress-versions'14{15}16module.exports = (on, config) => {17 require('cypress-versions/plugin')(

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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