How to use Kf method in Playwright Internal

Best JavaScript code snippet using playwright-internal

render.js

Source:render.js Github

copy

Full Screen

1/**2 * Created by hn on 14-3-17.3 */4define( function ( require ) {5 var kity = require( "kity" ),6 Assembly = require( "kf" ).Assembly,7 DEFAULT_OPTIONS = {8 autoresize: false,9 fontsize: 50,10 padding: [ 20, 50 ]11 },12 RenderComponenet = kity.createClass( 'RenderComponent', {13 // 异步组件14 base: require( "base/component" ),15 constructor: function ( kfEditor, options ) {16 this.callBase();17 this.options = kity.Utils.extend( {}, DEFAULT_OPTIONS, options );18 this.kfEditor = kfEditor;19 this.assembly = null;20 this.formula = null;21 // 是否禁用重定位22 this.relDisabled = false;23 this.canvasZoom = 1;24 this.record = {25 select: {},26 cursor: {},27 // 画布信息28 canvas: {}29 };30 this.initCanvas();31 this.initServices();32 this.initCommands();33 },34 initCanvas: function () {35 var canvasContainer = this.kfEditor.requestService( "ui.get.canvas.container" ),36 Formula = this.kfEditor.getFormulaClass();37 this.assembly = new Assembly( new Formula( canvasContainer, this.options ) );38 this.formula = this.assembly.formula;39 this.setCanvasToCenter();40 },41 setCanvasOffset: function ( offsetX, offsetY ) {42 var viewBox = this.formula.getViewBox();43 offsetY = offsetY !== undefined ? offsetY : -viewBox.height / 2;44 this.formula.setViewBox( offsetX, offsetY, viewBox.width, viewBox.height );45 },46 setCanvasToCenter: function () {47 var viewBox = this.formula.getViewBox();48 this.formula.setViewBox( -viewBox.width / 2, -viewBox.height / 2, viewBox.width, viewBox.height );49 },50 initServices: function () {51 this.kfEditor.registerService( "render.get.canvas", this, {52 getCanvas: this.getCanvas53 } );54 this.kfEditor.registerService( "render.get.content.size", this, {55 getContentSize: this.getContentSize56 } );57 this.kfEditor.registerService( "render.clear.canvas.transform", this, {58 clearCanvasOffset: this.clearCanvasTransform59 } );60 this.kfEditor.registerService( "render.set.canvas.offset", this, {61 setCanvasOffset: this.setCanvasOffset62 } );63 this.kfEditor.registerService( "render.set.canvas.to.center", this, {64 setCanvasToCenter: this.setCanvasToCenter65 } );66 this.kfEditor.registerService( "render.revert.canvas.transform", this, {67 revertCanvasTransform: this.revertCanvasTransform68 } );69 this.kfEditor.registerService( "render.relocation", this, {70 relocation: this.relocation71 } );72 this.kfEditor.registerService( "render.disable.relocation", this, {73 disableRelocation: this.disableRelocation74 } );75 this.kfEditor.registerService( "render.enable.relocation", this, {76 enableRelocation: this.enableRelocation77 } );78 this.kfEditor.registerService( "render.select.group.content", this, {79 selectGroupContent: this.selectGroupContent80 } );81 this.kfEditor.registerService( "render.select.group", this, {82 selectGroup: this.selectGroup83 } );84 this.kfEditor.registerService( "render.select.group.all", this, {85 selectAllGroup: this.selectAllGroup86 } );87 this.kfEditor.registerService( "render.tint.current.cursor", this, {88 tintCurrentGroup: this.tintCurrentGroup89 } );90 this.kfEditor.registerService( "render.select.current.cursor", this, {91 selectCurrentCursor: this.selectCurrentCursor92 } );93 this.kfEditor.registerService( "render.reselect", this, {94 reselect: this.reselect95 } );96 this.kfEditor.registerService( "render.clear.select", this, {97 clearSelect: this.clearSelect98 } );99 this.kfEditor.registerService( "render.set.canvas.zoom", this, {100 setCanvasZoom: this.setCanvasZoom101 } );102 this.kfEditor.registerService( "render.get.canvas.zoom", this, {103 getCanvasZoom: this.getCanvasZoom104 } );105 this.kfEditor.registerService( "render.get.paper.offset", this, {106 getPaperOffset: this.getPaperOffset107 } );108 this.kfEditor.registerService( "render.draw", this, {109 render: this.render110 } );111 this.kfEditor.registerService( "render.insert.string", this, {112 insertString: this.insertString113 } );114 this.kfEditor.registerService( "render.insert.group", this, {115 insertGroup: this.insertGroup116 } );117 this.kfEditor.registerService( "render.get.paper", this, {118 getPaper: this.getPaper119 } );120 },121 initCommands: function () {122 this.kfEditor.registerCommand( "render", this, function ( str ) {123 this.render( str );124 this.kfEditor.requestService( "ui.update.canvas.view" );125 } );126 this.kfEditor.registerCommand( "getPaper", this, this.getPaper );127 },128 relocation: function () {129 if ( !this.relDisabled ) {130 this.relocationToCenter();131 } else {132 this.relocationToLeft();133 }134 },135 relocationToCenter: function () {136 var formulaSpace = this.formula.container.getRenderBox();137 this.formula.container.setTranslate( -formulaSpace.width / 2, -formulaSpace.height / 2);138 this.setCanvasToCenter();139 },140 relocationToLeft: function () {141 var formulaSpace = this.formula.container.getRenderBox();142 this.formula.container.setTranslate( 0, -formulaSpace.height / 2 );143 this.setCanvasOffset( 0 );144 },145 selectGroup: function ( groupId ) {146 var groupObject = this.kfEditor.requestService( "syntax.get.group.object", groupId );147 this.clearSelect();148 if ( groupObject.node.getAttribute( "data-root" ) ) {149 // 根节点不着色150 return;151 }152 this.record.select.lastSelect = groupObject;153 groupObject.select();154 },155 selectGroupContent: function ( group ) {156 // 处理占位符157 if ( group.groupObj.getAttribute( "data-placeholder" ) !== null ) {158 group = {159 id: group.content[ 0 ].id160 };161 }162 var groupObject = this.kfEditor.requestService( "syntax.get.group.object", group.id );163 this.clearSelect();164 this.record.select.lastSelect = groupObject;165 if ( groupObject.node.getAttribute( "data-root" ) ) {166 // 根节点不着色167 return;168 }169 groupObject.select();170 },171 selectAllGroup: function ( group ) {172 // 处理占位符173 if ( group.groupObj.getAttribute( "data-placeholder" ) !== null ) {174 group = {175 id: group.content[ 0 ].id176 };177 }178 var groupObject = this.kfEditor.requestService( "syntax.get.group.object", group.id );179 this.clearSelect();180 this.record.select.lastSelect = groupObject;181 groupObject.selectAll();182 },183 /**184 * 根据当前光标信息绘制选区185 */186 selectCurrentCursor: function () {187 var cursorInfo = this.kfEditor.requestService( "syntax.get.record.cursor" ),188 group = this.kfEditor.requestService( "syntax.get.group.object", cursorInfo.groupId ),189 box = null,190 offset = -1,191 width = 0,192 startIndex = Math.min( cursorInfo.startOffset, cursorInfo.endOffset ),193 endIndex = Math.max( cursorInfo.startOffset, cursorInfo.endOffset );194 this.clearSelect();195 // 更新记录196 this.record.select.lastSelect = group;197 for ( var i = startIndex, len = endIndex; i < len; i++ ) {198 box = group.getOperand( i ).getRenderBox( group );199 if ( offset == -1 ) {200 offset = box.x;201 }202 width += box.width;203 }204 group.setBoxWidth( width );205 group.selectAll();206 group.getBox().setTranslate( offset, 0 );207 },208 /**209 * 根据当前的光标信息,对当前光标所在的容器进行着色210 */211 tintCurrentGroup: function () {212 var groupId = this.kfEditor.requestService( "syntax.get.record.cursor" ).groupId,213 groupObject = this.kfEditor.requestService( "syntax.get.group.object", groupId ),214 isPlaceholder = this.kfEditor.requestService( "syntax.is.placeholder.node", groupId );215 this.clearSelect();216 if ( groupObject.node.getAttribute( "data-root" ) ) {217 // 根节点不着色218 return;219 }220 // 占位符着色221 if ( isPlaceholder ) {222 // 替换占位符包裹组为占位符本身223 groupObject = this.kfEditor.requestService( "syntax.get.group.object", groupObject.operands[ 0 ].node.id );224 }225 this.record.select.lastSelect = groupObject;226 groupObject.select();227 },228 reselect: function () {229 var cursorInfo = this.kfEditor.requestService( "syntax.get.record.cursor" ),230 groupObject = null;231 groupObject = this.kfEditor.requestService( "syntax.get.group.object", cursorInfo.groupId );232 this.clearSelect();233 this.record.select.lastSelect = groupObject;234 if ( groupObject.node.getAttribute( "data-root" ) ) {235 // 根节点不着色236 return;237 }238 groupObject.select();239 },240 clearSelect: function () {241 var box = null,242 currentSelect = this.record.select.lastSelect;243 if ( !currentSelect || !currentSelect.node.ownerSVGElement ) {244 return;245 }246 currentSelect.unselect();247 box = currentSelect.getRenderBox( currentSelect );248 currentSelect.setBoxWidth( box.width );249 currentSelect.getBox().setTranslate( 0, 0 );250 },251 getPaper: function () {252 return this.formula;253 },254 render: function ( latexStr ) {255 var parsedTree = this.kfEditor.requestService( "parser.parse", latexStr, true ),256 objTree = this.assembly.regenerateBy( parsedTree );257 // 更新语法模块所维护的树258 this.kfEditor.requestService( "syntax.update.objtree", objTree );259 },260 enableRelocation: function () {261 this.relDisabled = false;262 },263 disableRelocation: function () {264 this.relDisabled = true;265 },266 setCanvasZoom: function ( zoom ) {267 var viewPort = this.formula.getViewPort();268 this.canvasZoom = zoom;269 viewPort.zoom = zoom;270 this.formula.setViewPort( viewPort );271 },272 getCanvas: function () {273 return this.formula;274 },275 getContentSize: function () {276 return this.formula.container.getRenderBox();277 },278 /**279 * 清除编辑器里内容的偏移280 */281 clearCanvasTransform: function () {282 var canvasInfo = this.record.canvas;283 canvasInfo.viewBox = this.formula.getViewBox();284 canvasInfo.contentOffset = this.formula.container.getTranslate();285 this.setCanvasToCenter();286 this.formula.node.removeAttribute( "viewBox" );287 this.formula.container.setTranslate( 0, 0 );288 },289 /**290 * 恢复被clearCanvasTransform清除的偏移, 该方法仅针对上一次清除有效,291 * 且该方法应该只有在调用clearCanvasTransform后才可以调用该方法,并且两者之间应该配对出现292 * @returns {boolean}293 */294 revertCanvasTransform: function () {295 var canvasInfo = this.record.canvas,296 viewBox = canvasInfo.viewBox;297 if ( !viewBox ) {298 return false;299 }300 this.formula.setViewBox( viewBox.x, viewBox.y, viewBox.width, viewBox.height );301 this.formula.container.setTranslate( canvasInfo.contentOffset );302 canvasInfo.viewBox = null;303 canvasInfo.contentOffset = null;304 },305 getCanvasZoom: function () {306 return this.canvasZoom;307 }308 } );309 return RenderComponenet;...

Full Screen

Full Screen

selection.js

Source:selection.js Github

copy

Full Screen

1/*!2 * 光标选区组件3 */4define( function ( require, exports, module ) {5 var kity = require( "kity" ),6 kfUtils = require( "base/utils" ),7 // 鼠标移动临界距离8 MAX_DISTANCE = 10;9 return kity.createClass( "SelectionComponent", {10 constructor: function ( parentComponent, kfEditor ) {11 this.parentComponent = parentComponent;12 this.kfEditor = kfEditor;13 this.isDrag = false;14 this.isMousedown = false;15 this.startPoint = {16 x: -1,17 y: -118 };19 // 起始位置是占位符20 this.startGroupIsPlaceholder = false;21 this.startGroup = {};22 this.initServices();23 this.initEvent();24 },25 initServices: function () {26 this.kfEditor.registerService( "control.select.all", this, {27 selectAll: this.selectAll28 } );29 },30 initEvent: function () {31 var eventServiceObject = this.kfEditor.request( "ui.canvas.container.event" ),32 _self = this;33 /* 选区拖拽 start */34 eventServiceObject.on( "mousedown", function ( e ) {35 e.preventDefault();36 // 存在根占位符, 禁止拖动37 if ( _self.kfEditor.requestService( "syntax.has.root.placeholder" ) ) {38 return false;39 }40 _self.isMousedown = true;41 _self.updateStartPoint( e.clientX, e.clientY );42 _self.updateStartGroup();43 } );44 eventServiceObject.on( "mouseup", function ( e ) {45 e.preventDefault();46 _self.stopUpdateSelection();47 } );48 eventServiceObject.on( "mousemove", function ( e ) {49 e.preventDefault();50 if ( !_self.isDrag ) {51 if ( _self.isMousedown ) {52 // 移动的距离达到临界条件53 if ( MAX_DISTANCE < _self.getDistance( e.clientX, e.clientY ) ) {54 _self.kfEditor.requestService( "control.cursor.hide" );55 _self.startUpdateSelection();56 }57 }58 } else {59 if ( e.which !== 1 ) {60 _self.stopUpdateSelection();61 return;62 }63 _self.updateSelection( e.target, e.clientX, e.clientY );64 }65 } );66 /* 选区拖拽 end */67 /* 双击选区 start */68 eventServiceObject.on( "dblclick", function ( e ) {69 _self.updateSelectionByTarget( e.target );70 } );71 /* 双击选区 end */72 },73 getDistance: function ( x, y ) {74 var distanceX = Math.abs( x - this.startPoint.x ),75 distanceY = Math.abs( y - this.startPoint.y );76 return Math.max( distanceX, distanceY );77 },78 updateStartPoint: function ( x, y ) {79 this.startPoint.x = x;80 this.startPoint.y = y;81 },82 updateStartGroup: function () {83 var cursorInfo = this.kfEditor.requestService( "syntax.get.record.cursor" );84 this.startGroupIsPlaceholder = this.kfEditor.requestService( "syntax.is.select.placeholder" );85 this.startGroup = {86 groupInfo: this.kfEditor.requestService( "syntax.get.group.content", cursorInfo.groupId ),87 offset: cursorInfo.startOffset88 };89 },90 startUpdateSelection: function () {91 this.isDrag = true;92 this.isMousedown = false;93 this.clearSelection();94 },95 stopUpdateSelection: function () {96 this.isDrag = false;97 this.isMousedown = false;98 this.kfEditor.requestService( "control.update.input" );99 },100 clearSelection: function () {101 this.kfEditor.requestService( "render.clear.select" );102 },103 updateSelection: function ( target, x, y ) {104 // 移动方向, true为右, false为左105 var dir = x > this.startPoint.x,106 cursorInfo = {},107 communityGroupInfo = null,108 inRightArea = false,109 startGroupInfo = this.startGroup,110 currentGroupNode = null,111 currentGroupInfo = this.getGroupInof( x, target );112 if ( currentGroupInfo.groupInfo.id === startGroupInfo.groupInfo.id ) {113 cursorInfo = {114 groupId: currentGroupInfo.groupInfo.id,115 startOffset: startGroupInfo.offset,116 endOffset: currentGroupInfo.offset117 };118 // 如果起始点是占位符, 要根据移动方向修正偏移119 if ( this.startGroupIsPlaceholder ) {120 // 左移修正121 if ( !dir ) {122 cursorInfo.startOffset += 1;123 // 右移修正124 } else if ( cursorInfo.startOffset === cursorInfo.endOffset ) {125 cursorInfo.endOffset += 1;126 }127 }128 } else {129 // 存在包含关系130 if ( kfUtils.contains( startGroupInfo.groupInfo.groupObj, currentGroupInfo.groupInfo.groupObj ) ) {131 cursorInfo = {132 groupId: startGroupInfo.groupInfo.id,133 startOffset: startGroupInfo.offset,134 endOffset: this.getIndex( startGroupInfo.groupInfo.groupObj, target, x )135 };136 } else if ( kfUtils.contains( currentGroupInfo.groupInfo.groupObj, startGroupInfo.groupInfo.groupObj ) ) {137 cursorInfo = {138 groupId: currentGroupInfo.groupInfo.id,139 startOffset: this.kfEditor.requestService( "position.get.index", currentGroupInfo.groupInfo.groupObj, startGroupInfo.groupInfo.groupObj ),140 endOffset: currentGroupInfo.offset141 };142 // 向左移动要修正开始偏移143 if ( !dir ) {144 cursorInfo.startOffset += 1;145 }146 // 都不存在包含关系147 } else {148 // 获取公共容器149 communityGroupInfo = this.getCommunityGroup( startGroupInfo.groupInfo, currentGroupInfo.groupInfo );150 // 修正偏移相同时的情况, 比如在分数中选中时151 if ( communityGroupInfo.startOffset === communityGroupInfo.endOffset ) {152 communityGroupInfo.endOffset += 1;153 // 根据拖拽方向修正各自的偏移154 } else {155 // 当前光标移动所在的组元素节点156 currentGroupNode = communityGroupInfo.group.content[ communityGroupInfo.endOffset ];157 inRightArea = this.kfEditor.requestService( "position.get.area", currentGroupNode, x );158 // 当前移动到右区域, 则更新结束偏移159 if ( inRightArea ) {160 communityGroupInfo.endOffset += 1;161 }162 // 左移动时, 修正起始偏移163 if ( !dir ) {164 communityGroupInfo.startOffset += 1;165 }166 }167 cursorInfo = {168 groupId: communityGroupInfo.group.id,169 startOffset: communityGroupInfo.startOffset,170 endOffset: communityGroupInfo.endOffset171 };172 }173 }174 // 更新光标信息175 this.kfEditor.requestService( "syntax.update.record.cursor", cursorInfo.groupId, cursorInfo.startOffset, cursorInfo.endOffset );176 // 仅重新选中就可以,不用更新输入框内容177 this.kfEditor.requestService( "control.reselect" );178 },179 updateSelectionByTarget: function ( target ) {180 var parentGroupInfo = this.kfEditor.requestService( "position.get.parent.group", target ),181 containerInfo = null,182 cursorInfo = {};183 if ( parentGroupInfo === null ) {184 return;185 }186 // 如果是根节点, 则直接选中其内容187 if ( this.kfEditor.requestService( "syntax.is.root.node", parentGroupInfo.id ) ) {188 this.selectAll();189 return;190 // 否则,仅选中该组191 } else {192 // 当前组可以是容器, 则选中该容器的内容193 if ( !this.kfEditor.requestService( "syntax.is.virtual.node", parentGroupInfo.id ) ) {194 cursorInfo = {195 groupId: parentGroupInfo.id,196 startOffset: 0,197 endOffset: parentGroupInfo.content.length198 };199 // 否则 直接选中该组的所有内容200 } else {201 // 获取包含父组的容器202 containerInfo = this.kfEditor.requestService( "position.get.group.info", parentGroupInfo.groupObj );203 cursorInfo = {204 groupId: containerInfo.group.id,205 startOffset: containerInfo.index,206 endOffset: containerInfo.index + 1207 };208 }209 }210 this.kfEditor.requestService( "syntax.update.record.cursor", cursorInfo );211 this.kfEditor.requestService( "control.reselect" );212 this.kfEditor.requestService( "control.update.input" );213 },214 selectAll: function () {215 var rootGroupInfo = this.kfEditor.requestService( "syntax.get.root.group.info" );216 var cursorInfo= {217 groupId: rootGroupInfo.id,218 startOffset: 0,219 endOffset: rootGroupInfo.content.length220 };221 this.kfEditor.requestService( "syntax.update.record.cursor", cursorInfo );222 this.kfEditor.requestService( "control.reselect" );223 this.kfEditor.requestService( "control.update.input" );224 },225 getGroupInof: function ( offset, target ) {226 var groupInfo = this.kfEditor.requestService( "position.get.group", target );227 if ( groupInfo === null ) {228 groupInfo = this.kfEditor.requestService( "syntax.get.root.group.info" );229 }230 var index = this.kfEditor.requestService( "position.get.location.info", offset, groupInfo );231 return {232 groupInfo: groupInfo,233 offset: index234 };235 },236 getIndex: function ( groupNode, targetNode, offset ) {237 var index = this.kfEditor.requestService( "position.get.index", groupNode, targetNode ),238 groupInfo = this.kfEditor.requestService( "syntax.get.group.content", groupNode.id ),239 targetWrapNode = groupInfo.content[ index ],240 targetRect = kfUtils.getRect( targetWrapNode );241 if ( ( targetRect.left + targetRect.width / 2 ) < offset ) {242 index += 1;243 }244 return index;245 },246 /**247 * 根据给定的两个组信息, 获取其所在的公共容器及其各自的偏移248 * @param startGroupInfo 组信息249 * @param endGroupInfo 另一个组信息250 */251 getCommunityGroup: function ( startGroupInfo, endGroupInfo ) {252 var bigBoundingGroup = null,253 targetGroup = startGroupInfo.groupObj,254 groupNode = null;255 while ( bigBoundingGroup = this.kfEditor.requestService( "position.get.group.info", targetGroup ) ) {256 targetGroup = bigBoundingGroup.group.groupObj;257 if ( kfUtils.contains( bigBoundingGroup.group.groupObj, endGroupInfo.groupObj ) ) {258 break;259 }260 }261 groupNode = bigBoundingGroup.group.groupObj;262 return {263 group: bigBoundingGroup.group,264 startOffset: bigBoundingGroup.index,265 endOffset: this.kfEditor.requestService( "position.get.index", groupNode, endGroupInfo.groupObj )266 };267 }268 } );...

Full Screen

Full Screen

Service.js

Source:Service.js Github

copy

Full Screen

1/**2 * The mock membership service object.3 */4Ext.define("Core.service.membership.mock.Service", {5 extend: "FlowMVC.mvc.service.mock.AbstractServiceMock",6 inject: [7 "logger"8 ],9 /**10 * The mock service call.11 */12 getMembershipSlide: function() {13 this.logger.debug("getMembershipSlide");14 var response = {15 success: true,16 membershipSlide: [17 { "kp_MembershipID": 1, "kf_PersonID": 1, "kf_OrganisationID": 1 },18 { "kp_MembershipID": 2, "kf_PersonID": 2, "kf_OrganisationID": 2 },19 { "kp_MembershipID": 3, "kf_PersonID": 3, "kf_OrganisationID": 3 },20 { "kp_MembershipID": 4, "kf_PersonID": 4, "kf_OrganisationID": 4 },21 { "kp_MembershipID": 5, "kf_PersonID": 5, "kf_OrganisationID": 5 },22 { "kp_MembershipID": 6, "kf_PersonID": 6, "kf_OrganisationID": 6 },23 { "kp_MembershipID": 7, "kf_PersonID": 7, "kf_OrganisationID": 7 },24 { "kp_MembershipID": 8, "kf_PersonID": 8, "kf_OrganisationID": 8 },25 { "kp_MembershipID": 9, "kf_PersonID": 9, "kf_OrganisationID": 9 },26 { "kp_MembershipID": 10, "kf_PersonID": 10, "kf_OrganisationID": 10 },27 { "kp_MembershipID": 11, "kf_PersonID": 11, "kf_OrganisationID": 11 },28 { "kp_MembershipID": 12, "kf_PersonID": 12, "kf_OrganisationID": 12 },29 { "kp_MembershipID": 13, "kf_PersonID": 13, "kf_OrganisationID": 13 },30 { "kp_MembershipID": 14, "kf_PersonID": 14, "kf_OrganisationID": 14 },31 { "kp_MembershipID": 15, "kf_PersonID": 15, "kf_OrganisationID": 15 },32 { "kp_MembershipID": 16, "kf_PersonID": 16, "kf_OrganisationID": 16 },33 { "kp_MembershipID": 17, "kf_PersonID": 17, "kf_OrganisationID": 17 },34 { "kp_MembershipID": 18, "kf_PersonID": 18, "kf_OrganisationID": 18 },35 { "kp_MembershipID": 19, "kf_PersonID": 19, "kf_OrganisationID": 19 },36 { "kp_MembershipID": 20, "kf_PersonID": 20, "kf_OrganisationID": 20 },37 { "kp_MembershipID": 21, "kf_PersonID": 21, "kf_OrganisationID": 21 },38 { "kp_MembershipID": 22, "kf_PersonID": 22, "kf_OrganisationID": 22 },39 { "kp_MembershipID": 23, "kf_PersonID": 23, "kf_OrganisationID": 23 },40 { "kp_MembershipID": 24, "kf_PersonID": 24, "kf_OrganisationID": 24 },41 { "kp_MembershipID": 25, "kf_PersonID": 25, "kf_OrganisationID": 25 },42 { "kp_MembershipID": 26, "kf_PersonID": 26, "kf_OrganisationID": 26 }43 ]44 };45 return this.delayedSuccess(response);46 },47 48 /**49 * The mock service call.50 */51 getMembershipList: function() {52 this.logger.debug("getMembershipList");53 var response = {54 success: true,55 membershipList: [56 { "kp_MembershipID": 1, "kf_PersonID": 1, "kf_OrganisationID": 1 },57 { "kp_MembershipID": 2, "kf_PersonID": 2, "kf_OrganisationID": 2 },58 { "kp_MembershipID": 3, "kf_PersonID": 3, "kf_OrganisationID": 3 },59 { "kp_MembershipID": 4, "kf_PersonID": 4, "kf_OrganisationID": 4 },60 { "kp_MembershipID": 5, "kf_PersonID": 5, "kf_OrganisationID": 5 },61 { "kp_MembershipID": 6, "kf_PersonID": 6, "kf_OrganisationID": 6 },62 { "kp_MembershipID": 7, "kf_PersonID": 7, "kf_OrganisationID": 7 },63 { "kp_MembershipID": 8, "kf_PersonID": 8, "kf_OrganisationID": 8 },64 { "kp_MembershipID": 9, "kf_PersonID": 9, "kf_OrganisationID": 9 },65 { "kp_MembershipID": 10, "kf_PersonID": 10, "kf_OrganisationID": 10 },66 { "kp_MembershipID": 11, "kf_PersonID": 11, "kf_OrganisationID": 11 },67 { "kp_MembershipID": 12, "kf_PersonID": 12, "kf_OrganisationID": 12 },68 { "kp_MembershipID": 13, "kf_PersonID": 13, "kf_OrganisationID": 13 },69 { "kp_MembershipID": 14, "kf_PersonID": 14, "kf_OrganisationID": 14 },70 { "kp_MembershipID": 15, "kf_PersonID": 15, "kf_OrganisationID": 15 },71 { "kp_MembershipID": 16, "kf_PersonID": 16, "kf_OrganisationID": 16 },72 { "kp_MembershipID": 17, "kf_PersonID": 17, "kf_OrganisationID": 17 },73 { "kp_MembershipID": 18, "kf_PersonID": 18, "kf_OrganisationID": 18 },74 { "kp_MembershipID": 19, "kf_PersonID": 19, "kf_OrganisationID": 19 },75 { "kp_MembershipID": 20, "kf_PersonID": 20, "kf_OrganisationID": 20 },76 { "kp_MembershipID": 21, "kf_PersonID": 21, "kf_OrganisationID": 21 },77 { "kp_MembershipID": 22, "kf_PersonID": 22, "kf_OrganisationID": 22 },78 { "kp_MembershipID": 23, "kf_PersonID": 23, "kf_OrganisationID": 23 },79 { "kp_MembershipID": 24, "kf_PersonID": 24, "kf_OrganisationID": 24 },80 { "kp_MembershipID": 25, "kf_PersonID": 25, "kf_OrganisationID": 25 },81 { "kp_MembershipID": 26, "kf_PersonID": 26, "kf_OrganisationID": 26 }82 ]83 };84 return this.delayedSuccess(response);85 },86 87 /**88 * The mock service call.89 */90 getMembershipTile: function() {91 this.logger.debug("getMembershipTile");92 var response = {93 success: true,94 membershipTile: [95 { "kp_MembershipID": 1, "kf_PersonID": 1, "kf_OrganisationID": 1 },96 { "kp_MembershipID": 2, "kf_PersonID": 2, "kf_OrganisationID": 2 },97 { "kp_MembershipID": 3, "kf_PersonID": 3, "kf_OrganisationID": 3 },98 { "kp_MembershipID": 4, "kf_PersonID": 4, "kf_OrganisationID": 4 },99 { "kp_MembershipID": 5, "kf_PersonID": 5, "kf_OrganisationID": 5 },100 { "kp_MembershipID": 6, "kf_PersonID": 6, "kf_OrganisationID": 6 },101 { "kp_MembershipID": 7, "kf_PersonID": 7, "kf_OrganisationID": 7 },102 { "kp_MembershipID": 8, "kf_PersonID": 8, "kf_OrganisationID": 8 },103 { "kp_MembershipID": 9, "kf_PersonID": 9, "kf_OrganisationID": 9 },104 { "kp_MembershipID": 10, "kf_PersonID": 10, "kf_OrganisationID": 10 },105 { "kp_MembershipID": 11, "kf_PersonID": 11, "kf_OrganisationID": 11 },106 { "kp_MembershipID": 12, "kf_PersonID": 12, "kf_OrganisationID": 12 },107 { "kp_MembershipID": 13, "kf_PersonID": 13, "kf_OrganisationID": 13 },108 { "kp_MembershipID": 14, "kf_PersonID": 14, "kf_OrganisationID": 14 },109 { "kp_MembershipID": 15, "kf_PersonID": 15, "kf_OrganisationID": 15 },110 { "kp_MembershipID": 16, "kf_PersonID": 16, "kf_OrganisationID": 16 },111 { "kp_MembershipID": 17, "kf_PersonID": 17, "kf_OrganisationID": 17 },112 { "kp_MembershipID": 18, "kf_PersonID": 18, "kf_OrganisationID": 18 },113 { "kp_MembershipID": 19, "kf_PersonID": 19, "kf_OrganisationID": 19 },114 { "kp_MembershipID": 20, "kf_PersonID": 20, "kf_OrganisationID": 20 },115 { "kp_MembershipID": 21, "kf_PersonID": 21, "kf_OrganisationID": 21 },116 { "kp_MembershipID": 22, "kf_PersonID": 22, "kf_OrganisationID": 22 },117 { "kp_MembershipID": 23, "kf_PersonID": 23, "kf_OrganisationID": 23 },118 { "kp_MembershipID": 24, "kf_PersonID": 24, "kf_OrganisationID": 24 },119 { "kp_MembershipID": 25, "kf_PersonID": 25, "kf_OrganisationID": 25 },120 { "kp_MembershipID": 26, "kf_PersonID": 26, "kf_OrganisationID": 26 }121 ]122 };123 return this.delayedSuccess(response);124 },125 126 /**127 * The mock service call.128 */129 createMembership: function(membership) {130 this.logger.debug("createMembership");131 var response = {132 success: true,133 membership: {134 kp_MembershipID: this.getRandomInt(1000, 99999),135 kf_PersonID: membership.kf_PersonID,136 kf_OrganisationID: membership.kf_OrganisationID 137 }138 };139 response = Ext.create("Core.model.membership.Model", response.membership);140 return this.delayedSuccess(response);141 },142 /**143 * The mock service call.144 */145 updateMembership: function(membership) {146 this.logger.debug("updateMembership: kp_MembershipID = ", membership.kp_MembershipID);147 var response = {148 success: true,149 membership: {150 kp_MembershipID: membership.kp_MembershipID,151 kf_PersonID: membership.kf_PersonID,152 kf_OrganisationID: membership.kf_OrganisationID 153 }154 };155 response = Ext.create("Core.model.membership.Model", response.membership);156 return this.delayedSuccess(response);157 },158 /**159 * The mock service call.160 */161 deleteMembership: function(membership) {162 this.logger.debug("deleteMembership: kp_MembershipID = ", membership.kp_MembershipID);163 var response = {164 success: true,165 membership: {166 kp_MembershipID: membership.kp_MembershipID,167 kf_PersonID: membership.kf_PersonID,168 kf_OrganisationID: membership.kf_OrganisationID 169 }170 };171 response = Ext.create("Core.model.membership.Model", response.membership);172 return this.delayedSuccess(response);173 }, 174 /**175 * The mock service call.176 */177 readMemberships: function() {178 this.logger.debug("readMemberships");179 var response = {180 success: true,181 memberships: [182 { "kp_MembershipID": 1, "kf_PersonID": 1, "kf_OrganisationID": 1 },183 { "kp_MembershipID": 2, "kf_PersonID": 2, "kf_OrganisationID": 2 },184 { "kp_MembershipID": 3, "kf_PersonID": 3, "kf_OrganisationID": 3 },185 { "kp_MembershipID": 4, "kf_PersonID": 4, "kf_OrganisationID": 4 },186 { "kp_MembershipID": 5, "kf_PersonID": 5, "kf_OrganisationID": 5 },187 { "kp_MembershipID": 6, "kf_PersonID": 6, "kf_OrganisationID": 6 },188 { "kp_MembershipID": 7, "kf_PersonID": 7, "kf_OrganisationID": 7 },189 { "kp_MembershipID": 8, "kf_PersonID": 8, "kf_OrganisationID": 8 },190 { "kp_MembershipID": 9, "kf_PersonID": 9, "kf_OrganisationID": 9 },191 { "kp_MembershipID": 10, "kf_PersonID": 10, "kf_OrganisationID": 10 },192 { "kp_MembershipID": 11, "kf_PersonID": 11, "kf_OrganisationID": 11 },193 { "kp_MembershipID": 12, "kf_PersonID": 12, "kf_OrganisationID": 12 },194 { "kp_MembershipID": 13, "kf_PersonID": 13, "kf_OrganisationID": 13 },195 { "kp_MembershipID": 14, "kf_PersonID": 14, "kf_OrganisationID": 14 },196 { "kp_MembershipID": 15, "kf_PersonID": 15, "kf_OrganisationID": 15 },197 { "kp_MembershipID": 16, "kf_PersonID": 16, "kf_OrganisationID": 16 },198 { "kp_MembershipID": 17, "kf_PersonID": 17, "kf_OrganisationID": 17 },199 { "kp_MembershipID": 18, "kf_PersonID": 18, "kf_OrganisationID": 18 },200 { "kp_MembershipID": 19, "kf_PersonID": 19, "kf_OrganisationID": 19 },201 { "kp_MembershipID": 20, "kf_PersonID": 20, "kf_OrganisationID": 20 },202 { "kp_MembershipID": 21, "kf_PersonID": 21, "kf_OrganisationID": 21 },203 { "kp_MembershipID": 22, "kf_PersonID": 22, "kf_OrganisationID": 22 },204 { "kp_MembershipID": 23, "kf_PersonID": 23, "kf_OrganisationID": 23 },205 { "kp_MembershipID": 24, "kf_PersonID": 24, "kf_OrganisationID": 24 },206 { "kp_MembershipID": 25, "kf_PersonID": 25, "kf_OrganisationID": 25 },207 { "kp_MembershipID": 26, "kf_PersonID": 26, "kf_OrganisationID": 26 }208 ]209 };210 return this.delayedSuccess(response);211 }212 ...

Full Screen

Full Screen

input.js

Source:input.js Github

copy

Full Screen

1 /*!2 * 输入控制组件3 */4define( function ( require, exports, module ) {5 var kity = require( "kity" ),6 kfUtils = require( "base/utils" ),7 InputFilter = require( "control/input-filter" ),8 KEY_CODE = {9 LEFT: 37,10 RIGHT: 39,11 DELETE: 8,12 // 输入法特殊处理13 INPUT: 22914 };15 return kity.createClass( "InputComponent", {16 constructor: function ( parentComponent, kfEditor ) {17 this.parentComponent = parentComponent;18 this.kfEditor = kfEditor;19 this.inputBox = this.createInputBox();20 this.initServices();21 this.initCommands();22 this.initEvent();23 },24 initServices: function () {25 this.kfEditor.registerService( "control.update.input", this, {26 updateInput: this.updateInput27 } );28 this.kfEditor.registerService( "control.insert.string", this, {29 insertStr: this.insertStr30 } );31 },32 initCommands: function () {33 this.kfEditor.registerCommand( "focus", this, this.focus );34 },35 createInputBox: function () {36 var editorContainer = this.kfEditor.getContainer(),37 box = this.kfEditor.getDocument().createElement( "input" );38 box.className = "kf-editor-input-box";39 box.type = "text";40 // focus是否可信41 box.isTrusted = false;42 editorContainer.appendChild( box );43 return box;44 },45 focus: function () {46 var rootInfo = null;47 this.inputBox.focus();48 // 如果当前不包含光标信息, 则手动设置光标信息, 以使得当前根节点被全选中49 if ( !this.kfEditor.requestService( "syntax.has.cursor.info" ) ) {50 rootInfo = this.kfEditor.requestService( "syntax.get.root.group.info" );51 this.kfEditor.requestService( "syntax.update.record.cursor", {52 groupId: rootInfo.id,53 startOffset: 0,54 endOffset: rootInfo.content.length55 } );56 this.kfEditor.requestService( "control.update.input" );57 }58 this.kfEditor.requestService( "control.reselect" );59 },60 setUntrusted: function () {61 this.inputBox.isTrusted = false;62 },63 setTrusted: function () {64 this.inputBox.isTrusted = true;65 },66 updateInput: function () {67 var latexInfo = this.kfEditor.requestService( "syntax.serialization" );68 this.setUntrusted();69 this.inputBox.value = latexInfo.str;70 this.inputBox.selectionStart = latexInfo.startOffset;71 this.inputBox.selectionEnd = latexInfo.endOffset;72 this.inputBox.focus();73 this.setTrusted();74 },75 insertStr: function ( str ) {76 var latexInfo = this.kfEditor.requestService( "syntax.serialization" ),77 originString = latexInfo.str;78 // 拼接latex字符串79 originString = originString.substring( 0, latexInfo.startOffset ) + " " + str + " " + originString.substring( latexInfo.endOffset );80 this.restruct( originString );81 this.updateInput();82 this.kfEditor.requestService( "ui.update.canvas.view" );83 },84 initEvent: function () {85 var _self = this;86 kfUtils.addEvent( this.inputBox, "keydown", function ( e ) {87 var isControl = false;88 if ( e.ctrlKey ) {89 // 处理用户控制行为90 _self.processUserCtrl( e );91 return;92 }93 switch ( e.keyCode ) {94 case KEY_CODE.INPUT:95 return;96 case KEY_CODE.LEFT:97 e.preventDefault();98 _self.leftMove();99 isControl = true;100 break;101 case KEY_CODE.RIGHT:102 e.preventDefault();103 _self.rightMove();104 isControl = true;105 break;106 case KEY_CODE.DELETE:107 e.preventDefault();108 _self.delete();109 isControl = true;110 break;111 }112 if ( isControl ) {113 _self.kfEditor.requestService( "ui.update.canvas.view" );114 }115 if ( !_self.pretreatmentInput( e ) ) {116 e.preventDefault();117 }118 } );119 // 用户输入120 kfUtils.addEvent( this.inputBox, "input", function ( e ) {121 _self.processingInput();122 } );123 // 光标显隐控制124 kfUtils.addEvent( this.inputBox, "blur", function ( e ) {125 _self.kfEditor.requestService( "ui.toolbar.disable" );126 _self.kfEditor.requestService( "ui.toolbar.close" );127 _self.kfEditor.requestService( "control.cursor.hide" );128 _self.kfEditor.requestService( "render.clear.select" );129 } );130 kfUtils.addEvent( this.inputBox, "focus", function ( e ) {131 _self.kfEditor.requestService( "ui.toolbar.enable" );132 if ( this.isTrusted ) {133 _self.kfEditor.requestService( "control.reselect" );134 }135 } );136 // 粘贴过滤137 kfUtils.addEvent( this.inputBox, "paste", function ( e ) {138 e.preventDefault();139 } );140 },141 hasRootplaceholder: function () {142 return this.kfEditor.requestService( "syntax.has.root.placeholder" );143 },144 leftMove: function () {145 // 当前处于"根占位符"上, 则不允许move146 if ( this.hasRootplaceholder() ) {147 return;148 }149 this.kfEditor.requestService( "syntax.cursor.move.left" );150 this.update();151 },152 rightMove: function () {153 if ( this.hasRootplaceholder() ) {154 return;155 }156 this.kfEditor.requestService( "syntax.cursor.move.right" );157 this.update();158 },159 delete: function () {160 var isNeedRedraw = null;161 // 当前处于"根占位符"上,不允许删除操作162 if ( this.hasRootplaceholder() ) {163 return;164 }165 // 返回是否修要重绘166 isNeedRedraw = this.kfEditor.requestService( "syntax.delete.group" );167 if ( isNeedRedraw ) {168 this.updateInput();169 this.processingInput();170 } else {171 this.updateInput();172 this.kfEditor.requestService( "control.reselect" );173 }174 },175 processUserCtrl: function ( e ) {176 e.preventDefault();177 switch ( e.keyCode ) {178 // ctrl + A179 case 65:180 this.kfEditor.requestService( "control.select.all" );181 break;182 // ctrl + S183 case 83:184 this.kfEditor.requestService( "print.image" );185 break;186 }187 },188 // 输入前的预处理, 执行输入过滤189 pretreatmentInput: function ( evt ) {190 var keyCode = this.getKeyCode( evt ),191 replaceStr = InputFilter.getReplaceString( keyCode );192 if ( replaceStr === null ) {193 return true;194 }195 this.insertStr( replaceStr );196 return false;197 },198 getKeyCode: function ( e ) {199 return ( e.shiftKey ? "s+" : "" ) + e.keyCode;200 },201 processingInput: function () {202 this.restruct( this.inputBox.value );203 this.kfEditor.requestService( "ui.update.canvas.view" );204 },205 // 根据给定的字符串重新进行构造公式206 restruct: function ( latexStr ) {207 this.kfEditor.requestService( "render.draw", latexStr );208 this.kfEditor.requestService( "control.reselect" );209 },210 update: function () {211 // 更新输入框212 this.updateInput();213 this.kfEditor.requestService( "control.reselect" );214 }215 } );...

Full Screen

Full Screen

location.js

Source:location.js Github

copy

Full Screen

1/*!2 * 光标定位组件3 */4define( function ( require, exports, module ) {5 var kity = require( "kity" );6 return kity.createClass( "LocationComponent", {7 constructor: function ( parentComponent, kfEditor ) {8 this.parentComponent = parentComponent;9 this.kfEditor = kfEditor;10 // 创建光标11 this.paper = this.getPaper();12 this.cursorShape = this.createCursor();13 this.initServices();14 this.initEvent();15 },16 getPaper: function () {17 return this.kfEditor.requestService( "render.get.paper" );18 },19 initServices: function () {20 // 重定位光标21 this.kfEditor.registerService( "control.cursor.relocation", this, {22 relocationCursor: this.updateCursor23 } );24 // 清除光标25 this.kfEditor.registerService( "control.cursor.hide", this, {26 hideCursor: this.hideCursor27 } );28 this.kfEditor.registerService( "control.reselect", this, {29 reselect: this.reselect30 } );31 this.kfEditor.registerService( "control.get.cursor.location", this, {32 getCursorLocation: this.getCursorLocation33 } );34 },35 createCursor: function () {36 var cursorShape = new kity.Rect( 1, 0, 0, 0 ).fill( "black" );37 cursorShape.setAttr( "style", "display: none" );38 this.paper.addShape( cursorShape );39 return cursorShape;40 },41 // 光标定位监听42 initEvent: function () {43 var eventServiceObject = this.kfEditor.request( "ui.canvas.container.event" ),44 _self = this;45 eventServiceObject.on( "mousedown", function ( e ) {46 e.preventDefault();47 _self.updateCursorInfo( e );48 _self.kfEditor.requestService( "control.update.input" );49 _self.reselect();50 } );51 },52 updateCursorInfo: function ( evt ) {53 var wrapNode = null,54 groupInfo = null,55 index = -1;56 // 有根占位符存在, 所有定位到定位到根占位符内部57 if ( this.kfEditor.requestService( "syntax.has.root.placeholder" ) ) {58 this.kfEditor.requestService( "syntax.update.record.cursor", {59 groupId: this.kfEditor.requestService( "syntax.get.root.group.info" ).id,60 startOffset: 0,61 endOffset: 162 } );63 return false;64 }65 wrapNode = this.kfEditor.requestService( "position.get.wrap", evt.target );66 // 占位符处理, 选中该占位符67 if ( wrapNode && this.kfEditor.requestService( "syntax.is.placeholder.node", wrapNode.id ) ) {68 groupInfo = this.kfEditor.requestService( "position.get.group.info", wrapNode );69 this.kfEditor.requestService( "syntax.update.record.cursor", groupInfo.group.id, groupInfo.index, groupInfo.index + 1 );70 return;71 }72 groupInfo = this.kfEditor.requestService( "position.get.group", evt.target );73 if ( groupInfo === null ) {74 groupInfo = this.kfEditor.requestService( "syntax.get.root.group.info" );75 }76 index = this.getIndex( evt.clientX, groupInfo );77 this.kfEditor.requestService( "syntax.update.record.cursor", groupInfo.id, index );78 },79 hideCursor: function () {80 this.cursorShape.setAttr( "style", "display: none" );81 },82 // 根据当前的光标信息, 对选区和光标进行更新83 reselect: function () {84 var cursorInfo = this.kfEditor.requestService( "syntax.get.record.cursor" ),85 groupInfo = null;86 this.hideCursor();87 // 根节点单独处理88 if ( this.kfEditor.requestService( "syntax.is.select.placeholder" ) ) {89 groupInfo = this.kfEditor.requestService( "syntax.get.group.content", cursorInfo.groupId );90 this.kfEditor.requestService( "render.select.group", groupInfo.content[ cursorInfo.startOffset ].id );91 return;92 }93 if ( cursorInfo.startOffset === cursorInfo.endOffset ) {94 // 更新光标位置95 this.updateCursor();96 // 请求背景着色97 this.kfEditor.requestService( "render.tint.current.cursor" );98 } else {99 this.kfEditor.requestService( "render.select.current.cursor" );100 }101 },102 updateCursor: function () {103 var cursorInfo = this.kfEditor.requestService( "syntax.get.record.cursor" );104 if ( cursorInfo.startOffset !== cursorInfo.endOffset ) {105 this.hideCursor();106 return;107 }108 var groupInfo = this.kfEditor.requestService( "syntax.get.group.content", cursorInfo.groupId ),109 isBefore = cursorInfo.endOffset === 0,110 index = isBefore ? 0 : cursorInfo.endOffset - 1,111 focusChild = groupInfo.content[ index ],112 paperContainerRect = getRect( this.paper.container.node ),113 cursorOffset = 0,114 focusChildRect = getRect( focusChild ),115 cursorTransform = this.cursorShape.getTransform( this.cursorShape ),116 canvasZoom = this.kfEditor.requestService( "render.get.canvas.zoom" ),117 formulaZoom = this.paper.getZoom();118 this.cursorShape.setHeight( focusChildRect.height / canvasZoom / formulaZoom );119 // 计算光标偏移位置120 cursorOffset = isBefore ? ( focusChildRect.left - 2 ) : ( focusChildRect.left + focusChildRect.width - 2 );121 cursorOffset -= paperContainerRect.left;122 // 定位光标123 cursorTransform.m.e = Math.floor( cursorOffset / canvasZoom / formulaZoom ) + 0.5 ;124 cursorTransform.m.f = ( focusChildRect.top - paperContainerRect.top ) / canvasZoom / formulaZoom;125 this.cursorShape.setMatrix( cursorTransform );126 this.cursorShape.setAttr( "style", "display: block" );127 },128 getCursorLocation: function () {129 var rect = this.cursorShape.getRenderBox( "paper" );130 return {131 x: rect.x,132 y: rect.y133 };134 },135 getIndex: function ( distance, groupInfo ) {136 var index = -1,137 children = groupInfo.content,138 boundingRect = null;139 for ( var i = children.length - 1, child = null; i >= 0; i-- ) {140 index = i;141 child = children[ i ];142 boundingRect = getRect( child );143 if ( boundingRect.left < distance ) {144 if ( boundingRect.left + boundingRect.width / 2 < distance ) {145 index += 1;146 }147 break;148 }149 }150 return index;151 }152 } );153 function getRect ( node ) {154 return node.getBoundingClientRect();155 }...

Full Screen

Full Screen

caseFirst.js

Source:caseFirst.js Github

copy

Full Screen

1// |reftest| skip-if(!this.hasOwnProperty("Intl"))2/* This Source Code Form is subject to the terms of the Mozilla Public3 * License, v. 2.0. If a copy of the MPL was not distributed with this4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */5// Locales which use caseFirst=off for the standard (sort) collation type.6const defaultLocales = Intl.Collator.supportedLocalesOf(["en", "de", "es", "sv", "ar", "zh", "ja"]);7// Locales which use caseFirst=upper for the standard (sort) collation type.8const upperFirstLocales = Intl.Collator.supportedLocalesOf(["cu", "da", "mt"]);9// Default collation for zh (pinyin) reorders "á" before "a" at secondary strength level.10const accentReordered = ["zh"];11const allLocales = [...defaultLocales, ...upperFirstLocales];12// Check default "caseFirst" option is resolved correctly.13for (let locale of defaultLocales) {14 let col = new Intl.Collator(locale, {usage: "sort"});15 assertEq(col.resolvedOptions().caseFirst, "false");16}17for (let locale of upperFirstLocales) {18 let col = new Intl.Collator(locale, {usage: "sort"});19 assertEq(col.resolvedOptions().caseFirst, "upper");20}21for (let locale of allLocales) {22 let col = new Intl.Collator(locale, {usage: "search"});23 assertEq(col.resolvedOptions().caseFirst, "false");24}25const collOptions = {usage: "sort"};26const primary = {sensitivity: "base"};27const secondary = {sensitivity: "accent"};28const tertiary = {sensitivity: "variant"};29const caseLevel = {sensitivity: "case"};30const strengths = [primary, secondary, tertiary, caseLevel];31// "A" is sorted after "a" when caseFirst=off is the default and strength is tertiary.32for (let locale of defaultLocales) {33 let col = new Intl.Collator(locale, Object.assign({}, collOptions, tertiary));34 assertEq(col.compare("A", "a"), 1);35 assertEq(col.compare("a", "A"), -1);36}37for (let locale of defaultLocales.filter(loc => !accentReordered.includes(loc))) {38 let col = new Intl.Collator(locale, Object.assign({}, collOptions, tertiary));39 assertEq(col.compare("A", "á"), -1);40 assertEq(col.compare("á", "A"), 1);41}42// Also sorted after "a" with the sensitivity=case collator.43for (let locale of defaultLocales) {44 let col = new Intl.Collator(locale, Object.assign({}, collOptions, caseLevel));45 assertEq(col.compare("A", "a"), 1);46 assertEq(col.compare("a", "A"), -1);47 assertEq(col.compare("A", "á"), 1);48 assertEq(col.compare("á", "A"), -1);49}50// "A" is sorted before "a" when caseFirst=upper is the default and strength is tertiary.51for (let locale of upperFirstLocales) {52 let col = new Intl.Collator(locale, Object.assign({}, collOptions, tertiary));53 assertEq(col.compare("A", "a"), -1);54 assertEq(col.compare("a", "A"), 1);55 assertEq(col.compare("A", "á"), -1);56 assertEq(col.compare("á", "A"), 1);57}58// Also sorted before "a" with the sensitivity=case collator.59for (let locale of upperFirstLocales) {60 let col = new Intl.Collator(locale, Object.assign({}, collOptions, caseLevel));61 assertEq(col.compare("A", "a"), -1);62 assertEq(col.compare("a", "A"), 1);63 assertEq(col.compare("A", "á"), -1);64 assertEq(col.compare("á", "A"), 1);65}66// caseFirst=upper doesn't change the sort order when strength is below tertiary.67for (let locale of allLocales) {68 let col = new Intl.Collator(locale, Object.assign({}, collOptions, secondary));69 assertEq(col.compare("A", "a"), 0);70 assertEq(col.compare("a", "A"), 0);71}72for (let locale of allLocales.filter(loc => !accentReordered.includes(loc))) {73 let col = new Intl.Collator(locale, Object.assign({}, collOptions, secondary));74 assertEq(col.compare("A", "á"), -1);75 assertEq(col.compare("á", "A"), 1);76}77for (let locale of allLocales) {78 let col = new Intl.Collator(locale, Object.assign({}, collOptions, primary));79 assertEq(col.compare("A", "a"), 0);80 assertEq(col.compare("a", "A"), 0);81 assertEq(col.compare("A", "á"), 0);82 assertEq(col.compare("á", "A"), 0);83}84// caseFirst=upper doesn't change the sort order when there's a primary difference.85for (let locale of allLocales) {86 for (let strength of strengths) {87 let col = new Intl.Collator(locale, Object.assign({}, collOptions, strength));88 assertEq(col.compare("A", "b"), -1);89 assertEq(col.compare("a", "B"), -1);90 }91}92// caseFirst set through Unicode extension tag.93for (let locale of allLocales) {94 let colKfFalse = new Intl.Collator(locale + "-u-kf-false", {});95 let colKfLower = new Intl.Collator(locale + "-u-kf-lower", {});96 let colKfUpper = new Intl.Collator(locale + "-u-kf-upper", {});97 assertEq(colKfFalse.resolvedOptions().caseFirst, "false");98 assertEq(colKfFalse.compare("A", "a"), 1);99 assertEq(colKfFalse.compare("a", "A"), -1);100 assertEq(colKfLower.resolvedOptions().caseFirst, "lower");101 assertEq(colKfLower.compare("A", "a"), 1);102 assertEq(colKfLower.compare("a", "A"), -1);103 assertEq(colKfUpper.resolvedOptions().caseFirst, "upper");104 assertEq(colKfUpper.compare("A", "a"), -1);105 assertEq(colKfUpper.compare("a", "A"), 1);106}107// caseFirst set through options value.108for (let locale of allLocales) {109 let colKfFalse = new Intl.Collator(locale, {caseFirst: "false"});110 let colKfLower = new Intl.Collator(locale, {caseFirst: "lower"});111 let colKfUpper = new Intl.Collator(locale, {caseFirst: "upper"});112 assertEq(colKfFalse.resolvedOptions().caseFirst, "false");113 assertEq(colKfFalse.compare("A", "a"), 1);114 assertEq(colKfFalse.compare("a", "A"), -1);115 assertEq(colKfLower.resolvedOptions().caseFirst, "lower");116 assertEq(colKfLower.compare("A", "a"), 1);117 assertEq(colKfLower.compare("a", "A"), -1);118 assertEq(colKfUpper.resolvedOptions().caseFirst, "upper");119 assertEq(colKfUpper.compare("A", "a"), -1);120 assertEq(colKfUpper.compare("a", "A"), 1);121}122// Test Unicode extension tag and options value, the latter should win.123for (let locale of allLocales) {124 let colKfFalse = new Intl.Collator(locale + "-u-kf-upper", {caseFirst: "false"});125 let colKfLower = new Intl.Collator(locale + "-u-kf-upper", {caseFirst: "lower"});126 let colKfUpper = new Intl.Collator(locale + "-u-kf-lower", {caseFirst: "upper"});127 assertEq(colKfFalse.resolvedOptions().caseFirst, "false");128 assertEq(colKfFalse.compare("A", "a"), 1);129 assertEq(colKfFalse.compare("a", "A"), -1);130 assertEq(colKfLower.resolvedOptions().caseFirst, "lower");131 assertEq(colKfLower.compare("A", "a"), 1);132 assertEq(colKfLower.compare("a", "A"), -1);133 assertEq(colKfUpper.resolvedOptions().caseFirst, "upper");134 assertEq(colKfUpper.compare("A", "a"), -1);135 assertEq(colKfUpper.compare("a", "A"), 1);136}137// Ensure languages are properly detected when additional subtags are present.138if (Intl.Collator.supportedLocalesOf("da").length !== 0) {139 assertEq(new Intl.Collator("da-DK", {usage: "sort"}).resolvedOptions().caseFirst, "upper");140 assertEq(new Intl.Collator("da-Latn-DK", {usage: "sort"}).resolvedOptions().caseFirst, "upper");141}142if (Intl.Collator.supportedLocalesOf("mt").length !== 0) {143 assertEq(new Intl.Collator("mt-MT", {usage: "sort"}).resolvedOptions().caseFirst, "upper");144 assertEq(new Intl.Collator("mt-Latn-MT", {usage: "sort"}).resolvedOptions().caseFirst, "upper");145}146if (typeof reportCompare === "function")...

Full Screen

Full Screen

jquery.modal.js

Source:jquery.modal.js Github

copy

Full Screen

1/*2 A simple jQuery kfModal (http://github.com/kylefox/jquery-kfModal)3 Version 0.6.04*/5(function($) {6 var current = null;7 $.kfModal = function(el, options) {8 $.kfModal.close(); // Close any open kfModals.9 var remove, target;10 this.$body = $('body');11 this.options = $.extend({}, $.kfModal.defaults, options);12 this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10));13 if (el.is('a')) {14 target = el.attr('href');15 //Select element by id from href16 if (/^#/.test(target)) {17 this.$elm = $(target);18 if (this.$elm.length !== 1) return null;19 this.$body.append(this.$elm);20 this.open();21 //AJAX22 } else {23 this.$elm = $('<div>');24 this.$body.append(this.$elm);25 remove = function(event, kfModal) { kfModal.elm.remove(); };26 this.showSpinner();27 el.trigger($.kfModal.AJAX_SEND);28 $.get(target).done(function(html) {29 if (!current) return;30 el.trigger($.kfModal.AJAX_SUCCESS);31 current.$elm.empty().append(html).on($.kfModal.CLOSE, remove);32 current.hideSpinner();33 current.open();34 el.trigger($.kfModal.AJAX_COMPLETE);35 }).fail(function() {36 el.trigger($.kfModal.AJAX_FAIL);37 current.hideSpinner();38 el.trigger($.kfModal.AJAX_COMPLETE);39 });40 }41 } else {42 this.$elm = el;43 this.$body.append(this.$elm);44 this.open();45 }46 };47 $.kfModal.prototype = {48 constructor: $.kfModal,49 open: function() {50 var m = this;51 if(this.options.doFade) {52 this.block();53 setTimeout(function() {54 m.show();55 }, this.options.fadeDuration * this.options.fadeDelay);56 } else {57 this.block();58 this.show();59 }60 if (this.options.escapeClose) {61 $(document).on('keydown.kfModal', function(event) {62 if (event.which == 27) $.kfModal.close();63 });64 }65 if (this.options.clickClose) this.blocker.click(function(e){66 if (e.target==this)67 $.kfModal.close();68 });69 },70 close: function() {71 this.unblock();72 this.hide();73 $(document).off('keydown.kfModal');74 },75 block: function() {76 this.$elm.trigger($.kfModal.BEFORE_BLOCK, [this._ctx()]);77 this.blocker = $('<div class="jquery-kfModal blocker"></div>');78 this.$body.css('overflow','hidden');79 this.$body.append(this.blocker);80 if(this.options.doFade) {81 this.blocker.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);82 }83 this.$elm.trigger($.kfModal.BLOCK, [this._ctx()]);84 },85 unblock: function() {86 if(this.options.doFade) {87 var self=this;88 this.blocker.fadeOut(this.options.fadeDuration, function() {89 self.blocker.children().appendTo(self.$body);90 self.blocker.remove();91 self.$body.css('overflow','');92 });93 } else {94 this.blocker.children().appendTo(this.$body);95 this.blocker.remove();96 this.$body.css('overflow','');97 }98 },99 show: function() {100 this.$elm.trigger($.kfModal.BEFORE_OPEN, [this._ctx()]);101 if (this.options.showClose) {102 this.closeButton = $('<a href="#close-kfModal" rel="kfModal:close" class="close-kfModal ' + this.options.closeClass + '">' + this.options.closeText + '</a>');103 this.$elm.append(this.closeButton);104 }105 this.$elm.addClass(this.options.kfModalClass + ' current');106 this.$elm.appendTo(this.blocker);107 if(this.options.doFade) {108 this.$elm.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);109 } else {110 this.$elm.show();111 }112 this.$elm.trigger($.kfModal.OPEN, [this._ctx()]);113 },114 hide: function() {115 this.$elm.trigger($.kfModal.BEFORE_CLOSE, [this._ctx()]);116 if (this.closeButton) this.closeButton.remove();117 this.$elm.removeClass('current');118 var _this = this;119 if(this.options.doFade) {120 this.$elm.fadeOut(this.options.fadeDuration, function () {121 _this.$elm.trigger($.kfModal.AFTER_CLOSE, [_this._ctx()]);122 });123 } else {124 this.$elm.hide(0, function () {125 _this.$elm.trigger($.kfModal.AFTER_CLOSE, [_this._ctx()]);126 });127 }128 this.$elm.trigger($.kfModal.CLOSE, [this._ctx()]);129 },130 showSpinner: function() {131 if (!this.options.showSpinner) return;132 this.spinner = this.spinner || $('<div class="' + this.options.kfModalClass + '-spinner"></div>')133 .append(this.options.spinnerHtml);134 this.$body.append(this.spinner);135 this.spinner.show();136 },137 hideSpinner: function() {138 if (this.spinner) this.spinner.remove();139 },140 //Return context for custom events141 _ctx: function() {142 return { elm: this.$elm, blocker: this.blocker, options: this.options };143 }144 };145 $.kfModal.close = function(event) {146 if (!current) return;147 if (event) event.preventDefault();148 current.close();149 var that = current.$elm;150 current = null;151 return that;152 };153 // Returns if there currently is an active kfModal154 $.kfModal.isActive = function () {155 return current ? true : false;156 }157 $.kfModal.defaults = {158 escapeClose: true,159 clickClose: true,160 closeText: 'Close',161 closeClass: '',162 kfModalClass: "kfModal",163 spinnerHtml: null,164 showSpinner: true,165 showClose: true,166 fadeDuration: null, // Number of milliseconds the fade animation takes.167 fadeDelay: 1.0 // Point during the overlay's fade-in that the kfModal begins to fade in (.5 = 50%, 1.5 = 150%, etc.)168 };169 // Event constants170 $.kfModal.BEFORE_BLOCK = 'kfModal:before-block';171 $.kfModal.BLOCK = 'kfModal:block';172 $.kfModal.BEFORE_OPEN = 'kfModal:before-open';173 $.kfModal.OPEN = 'kfModal:open';174 $.kfModal.BEFORE_CLOSE = 'kfModal:before-close';175 $.kfModal.CLOSE = 'kfModal:close';176 $.kfModal.AFTER_CLOSE = 'kfModal:after-close';177 $.kfModal.AJAX_SEND = 'kfModal:ajax:send';178 $.kfModal.AJAX_SUCCESS = 'kfModal:ajax:success';179 $.kfModal.AJAX_FAIL = 'kfModal:ajax:fail';180 $.kfModal.AJAX_COMPLETE = 'kfModal:ajax:complete';181 $.fn.kfModal = function(options){182 if (this.length === 1) {183 current = new $.kfModal(this, options);184 }185 return this;186 };187 // Automatically bind links with rel="kfModal:close" to, well, close the kfModal.188 $(document).on('click.kfModal', 'a[rel="kfModal:close"]', $.kfModal.close);189 $(document).on('click.kfModal', 'a[rel="kfModal:open"]', function(event) {190 event.preventDefault();191 $(this).kfModal();192 });...

Full Screen

Full Screen

change_KF_value_expression.js

Source:change_KF_value_expression.js Github

copy

Full Screen

1//Экспрешн, который позволяет менять значение одного кейфрейма, с сохранением кривых анимации. Править первые две строчки2myKfNum = 3;//номер кейфрема3myKfNewValue = 180;//новое значение для этого кейфрейма4Array.prototype.linear = function(tMin,tMax,val1,val2)5{6 if(arguments.length<4)7 return this;8 for(var i=0;i<arguments.length;i++)9 if(!arguments[i] instanceof Array)10 return this;11 var newVal = [];12 for(var k=0;k<this.length;k++)13 if(tMin[k]<=tMax[k])14 newVal[k] = linear(this[k],tMin[k],tMax[k],val1[k],val2[k]);15 else16 newVal[k] = linear(this[k],tMin[k],tMax[k],val2[k],val1[k]);17 return newVal;18}19myKfOldValue = key(myKfNum).value//старое значение маркера20myKfTime = key(myKfNum).time//время кейфрейма21if(time <= myKfTime)//участок до нашего кейфрейма22 if(myKfNum == 1)//если это первый кейфрейм23 myKfNewValue;//не анимируем анимацию до него (её нет)24 else25 {26 prevKfTime = key(myKfNum - 1).time//время предыдущего маркера27 prevKfValue = key(myKfNum - 1).value//значение предыдущего маркера28 if(time >= prevKfTime)//если мы в промежутке между нашим и предыдущим кейфреймами29 if(value instanceof Array)30 value.linear(prevKfValue,myKfOldValue,prevKfValue,myKfNewValue);//МАГИЯ31 else32 if(prevKfValue < myKfOldValue)33 linear(value,prevKfValue,myKfOldValue,prevKfValue,myKfNewValue);//МАГИЯ34 else35 linear(value,prevKfValue,myKfOldValue,myKfNewValue,prevKfValue);//МАГИЯ36 else //если мы до промежутка с измененной анимацией37 value;//ниче не делаем38 }39else //УЧАСТОК ПОСЛЕ НАШЕГО КЕЙФРЕЙМА40 if(myKfNum == numKeys)//если это последний кейфрейм41 myKfNewValue;//не анимируем42 else43 {44 nextKfTime = key(myKfNum+1).time;////время следующего маркера45 nextKfValue = key(myKfNum+1).value;//значение следующего маркера46 if(time<=nextKfTime)47 if(value instanceof Array)48 value.linear(myKfOldValue,nextKfValue,myKfNewValue,nextKfValue);//МАГИЯ49 else50 {51 if(myKfOldValue < nextKfValue)52 linear(value,myKfOldValue,nextKfValue,myKfNewValue,nextKfValue);//МАГИЯ53 else54 linear(value,myKfOldValue,nextKfValue,nextKfValue,myKfNewValue);//МАГИЯ55 }56 else value;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const context = await browser.newContext();5 const page = await context.newPage();6 const element = await page.$('input[name="q"]');7 await element.type('playwright');8 await element.press('Enter');9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2test('basic test', async ({ page }) => {3 const title = page.locator('.navbar__inner .navbar__title');4 await expect(title).toHaveText('Playwright');5});6const { test, expect } = require('@playwright/test');7test('basic test', async ({ page }) => {8 const title = page.locator('.navbar__inner .navbar__title');9 await expect(title).toHaveText('Playwright');10});11 at ExecutionContext._evaluateInternal (C:\Users\test\Documents\Playwright\playwright\lib\server\chromium\chromium.js:568:19)12 at processTicksAndRejections (internal/process/task_queues.js:93:5)13 at async ExecutionContext.evaluate (C:\Users\test\Documents\Playwright\playwright\lib\server\chromium\chromium.js:556:16)14 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:147:29)15 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:139:16)16 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:139:16)17 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:139:16)18 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:139:16)19 at async Locator._createHandle (C:\Users\test\Documents\Playwright\playwright\lib\server\locator.js:139:16)20 at async Locator._createHandle (C

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Kf } = require('@playwright/test');2const { test, expect } = require('@playwright/test');3test('my test', async ({ page }) => {4 await Kf(page).click('text=Get Started');5 await Kf(page).click('text=Docs');6 await Kf(page).click('text=API')

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2const { Kf } = require('kf-playwright');3const { Page } = require('@playwright/test/types/page');4const { ElementHandle } = require('@playwright/test/types/elementHandler');5test('Kf test', async ({ page }) => {6 const input = await Kf.$('input', page);7 await input.type('Kf');8 await page.keyboard.press('Enter');9 const result = await Kf.$('h3', page);10 await expect(result).toHaveText('Kf');11});12You can find the full API documentation [here](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Kf } = require('playwright');2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 const kf = new Kf(page);5 await kf.click('button');6});7const { Kf } = require('playwright');8const { test } = require('@playwright/test');9test('test', async ({ page }) => {10 const kf = new Kf(page);11 await kf.click('button');12});13const { Kf } = require('playwright');14const { Kf } = require('playwright');15const { Kf } = require('playwright');16const { Kf } = require('playwright');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2const { Kf } = require('./kf');3test('test', async ({ page }) => {4 const title = await Kf(page).title();5 expect(title).toBe('Playwright');6});7const { chromium } = require('playwright');8const { Kf } = require('./kf');9module.exports = {10 Kf: async (page) => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 return page;15 },16};17module.exports = {18 }19}20const { Kf } = require('./kf');21test('test', async ({ page }) => {22 const title = await Kf(page).title();23 expect(title).toBe('Playwright');24});25I’m still a little confused about how the kf.js file is being used. I would have thought that I would be able to use the Kf method in the test.js file without having to export it from the kf.js file. I would have thought that the kf.js file would be automatically imported into the test.js file. Is that not the case?

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2const { Kf } = require('kf-playwright-internal');3test.describe('Kf Playwright Internal', () => {4 let page;5 let kf;6 test.beforeAll(async ({ browser }) => {7 page = await browser.newPage();8 kf = new Kf(page);9 });10 test('Kf Playwright Internal', async () => {11 await kf.click('a');12 const text = await kf.getText('h1');13 expect(text).toBe('Example Domain');14 });15});16await kf.click('a');17const text = await kf.getText('h1');18const textArray = await kf.getTextArray('h1');19const href = await kf.getAttribute('a', 'href');20const hrefArray = await kf.getAttributeArray('a', 'href');21await kf.type('input[type="text"]', 'Hello');22await kf.press('input[type="text"]', 'Enter');23await kf.waitForNavigation();24await kf.waitForSelector('a');25await kf.waitForText('a', 'Example Domain');26await kf.waitForTextArray('a', ['Example Domain', 'Example Domain 2']);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2test('Test 1', async ({ page }) => {3 let element = await page.$('text=Get Started');4 await element.kf.click();5 await page.waitForLoadState();6});7import { test, expect } from '@playwright/test';8test('Test 2', async ({ page }) => {9 let element = await page.$('text=Get Started');10 await element.kf.click();11 await page.waitForLoadState();12});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Kf } = require('@katalon/playwright');2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 await Kf.playwright.internal.page(page).type('input[name="q"]', 'Hello World!');5 await Kf.playwright.internal.page(page).click('input[value="Google Search"]');6});7const { Kf } = require('@katalon/playwright');8const { test } = require('@playwright/test');9test('test', async ({ page }) => {10 await Kf.playwright.internal.page(page).type('input[name="q"]', 'Hello World!');11 await Kf.playwright.internal.page(page).click('input[value="Google Search"]');12});13const { Kf } = require('@katalon/playwright');14const { test } = require('@playwright/test');15test('test', async ({ page }) => {16 await Kf.playwright.internal.page(page).type('input[name="q"]', 'Hello World!');17 await Kf.playwright.internal.page(page).click('input[value="Google Search"]');18});19const { Kf } = require('@katalon/playwright');20const { test } = require('@playwright/test');21test('test', async ({ page }) => {22 await Kf.playwright.internal.page(page).type('input[name="q"]', 'Hello World!');23 await Kf.playwright.internal.page(page).click('input[value="Google Search"]');24});25const { Kf } = require('@katalon/playwright');26const { test } = require('@playwright/test');27test('test', async ({ page }) => {

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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