Skip to content

Commit

Permalink
Merge pull request #125 from BipanKishore/text-area-click-fix
Browse files Browse the repository at this point in the history
text-area-click-fix
  • Loading branch information
BipanKishore authored Jul 14, 2024
2 parents b9b2204 + 5c61a64 commit cf023ce
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/resizable-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resizable-core",
"version": "6.0.13",
"version": "6.0.14",
"description": "A straightforward library that enables dynamic resizing of layouts and saves the layout configurations.",
"module": "./lib/esm/index.esm.js",
"main": "./lib/cjs/index.cjs.js",
Expand Down
1 change: 0 additions & 1 deletion packages/resizable-core/src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const getResizableEventFromMouse = (e: any, vertical: boolean): IResizabl
}

export const getResizableEvent = (e: any, vertical: boolean, previousTouchEvent: any): IResizableEvent => {
e.preventDefault()
return isTouchEvent(e)
? getResizableEventFromTouch(e, vertical, previousTouchEvent)
: getResizableEventFromMouse(e, vertical)
Expand Down
2 changes: 1 addition & 1 deletion packages/resizable-panes-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resizable-panes-js",
"version": "6.0.25",
"version": "6.0.26",
"description": "A straightforward library that enables dynamic resizing of layouts and saves the layout configurations.",
"module": "./lib/esm/index.esm.js",
"main": "./lib/cjs/index.cjs.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/resizable-panes-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resizable-panes-next",
"version": "6.0.27",
"version": "6.0.28",
"description": "A straightforward library that enables dynamic resizing of layouts and saves the layout configurations.",
"module": "./lib/esm/index.esm.js",
"main": "./lib/cjs/index.cjs.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const maxSizeClassTest = 'maxSizeClassTest'

const loadingId = 'loading'
const loadedId = 'loaded'

const textAreaP1 = 'textArea-P1'
export {
containerId,
loadingId,
Expand All @@ -31,5 +33,6 @@ export {
rScontainerId,
R0, R1, R2, R3, R4, R5,
CK0, CK1, CK2, CK3, CK4, CK5, CK6,
P0, P1, P2, P3, P4, P5, P6
P0, P1, P2, P3, P4, P5, P6,
textAreaP1
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
noMinMax5PanesSet,
withMinMaxWithMinMaxUnitPixel5PanesSet
} from '../pane-model-config-sets'
import {CK0, L0, LG0, R0, R1, rScontainerId} from '../fix-test-ids'
import {CK0, L0, LG0, R0, R1, rScontainerId, textAreaP1} from '../fix-test-ids'
import {CustomResizerFirst} from '../../components/custom-resizer'
import {ResizableComponentCustomPanesTestWrapper}
from '../../components/rp-test-wrapper/resizable-component-custom-panes-test-wrapper'
Expand Down Expand Up @@ -220,4 +220,36 @@ describe('Test Pane Model', () => {
})
})
})

describe('Text area editing', () => {
it('should call api method getMap', () => {
cy.viewport(1000, 1000)
cy.mount(
<ResizableComponentCustomPanesTestWrapper
resizer={<CustomResizerFirst horizontal={false} size={10} />}
resizerSize={10}
storageApi={localStorage}
uniqueId={rScontainerId}
unmountOnHide={false}
vertical
>
<Pane
className="bg-orange-500" id="P0" size={1}
unmountOnHide={true}
>

<textarea className='w-100p h-100p' data-cy={textAreaP1} />
</Pane>
<Pane className="bg-teal-500" id="P1" size={1}>

<PaneChild hook='P1' />
</Pane>
</ResizableComponentCustomPanesTestWrapper>
)
cy.wait(50)
rCy.cyGet(textAreaP1)
.type('text test')
.should('have.value', 'text test')
})
})
})
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {SinonSpy} from 'cypress/types/sinon'
import {getResizableEvent} from '../../../../resizable-core'

describe('Dom utils', () => {
describe('It should test getResizableEvent for Touch evevts', () => {
let preventDefault: SinonSpy
const event = {
type: 'touch',
preventDefault,
targetTouches: [{
clientX: 10,
pageX: 10,
Expand All @@ -16,8 +13,7 @@ describe('Dom utils', () => {
}

beforeEach(() => {
preventDefault = cy.spy()
event.preventDefault = preventDefault

})

afterEach(() => {
Expand All @@ -26,18 +22,13 @@ describe('Dom utils', () => {

it('should test getResizableEvent vertical panes ', () => {
const retValue = [10, 10]

const value = getResizableEvent(event, true, {})
expect(preventDefault.calledOnce).to.equal(true)

expect(value).to.deep.equals(retValue)
})

it('should test getResizableEvent Horizontal panes ', () => {
const retValue = [20, 20]
const value = getResizableEvent(event, false, {})
expect(preventDefault.calledOnce).to.equal(true)

expect(value).to.deep.equals(retValue)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/resizable-panes-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resizable-panes-react",
"version": "6.0.25",
"version": "6.0.26",
"description": "A straightforward library that enables dynamic resizing of layouts and saves the layout configurations.",
"module": "./lib/esm/index.esm.js",
"main": "./lib/cjs/index.cjs.js",
Expand Down

0 comments on commit cf023ce

Please sign in to comment.