ProWM-Bench / data /rs /probes /hacker0x01__react-datepicker-5503.json
simonlqy's picture
Initial release of ProWM-Bench v1.0.0 (part 2)
ea621d1 verified
Raw History Blame Contribute Delete
3.13 kB
{
"build_script": "build",
"build_workdir": ".",
"bundle_artifact": "",
"decision_relevant_fields": [
"adapter_state.in_selecting_range_count",
"adapter_state.header_month"
],
"execution_mode": "node",
"expected_page_errors": [],
"instance_id": "hacker0x01__react-datepicker-5503",
"payload": {},
"predicate_description": "The calendar shows no days with the --in-selecting-range class in the next month once endDate is selected.",
"predicate_js": "(s) => s.adapter_state.render_ok === true && s.adapter_state.in_selecting_range_count === 0",
"product_output_kind": "rendered_document",
"program_js": "const fs = require('fs');\nconst path = require('path');\nconst input = JSON.parse(Buffer.from(process.argv[1], 'base64').toString('utf8'));\nconst outputPath = process.argv[2];\n\nconst React = require('/testbed/node_modules/react');\nconst ReactDOMServer = require('/testbed/node_modules/react-dom/server');\nconst sass = require('/testbed/node_modules/sass');\n\nconst DatePicker = require('/testbed/dist/index.js').default;\n\nconst startDate = new Date('2025/02/03');\nconst endDate = new Date('2025/02/08');\nconst openToDate = new Date('2025/03/18');\n\nlet html = '';\nlet css = '';\nlet err = null;\nlet ok = false;\nlet inRangeCount = 0;\nlet headerMonth = '';\n\ntry {\n const element = React.createElement(DatePicker, {\n inline: true,\n selectsEnd: true,\n startDate,\n endDate,\n minDate: startDate,\n openToDate,\n });\n html = ReactDOMServer.renderToString(element);\n\n const headerMatch = html.match(/react-datepicker__current-month\">([^<]+)</);\n headerMonth = headerMatch ? headerMatch[1] : '';\n\n const matches = html.match(/react-datepicker__day--in-selecting-range/g);\n inRangeCount = matches ? matches.length : 0;\n\n const scssPath = path.join('/testbed', 'src', 'stylesheets', 'datepicker.scss');\n const result = sass.compile(scssPath, { style: 'expanded' });\n css = result.css;\n\n ok = true;\n} catch (e) {\n err = { name: String(e && e.name || 'Error'), message: String(e && e.message || e) };\n}\n\nconst state = {\n render_ok: ok,\n error: err,\n in_selecting_range_count: inRangeCount,\n header_month: headerMonth,\n};\n\nconst page = `<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>${String(input.title).replace(/</g, '&lt;')}</title>\n<style>${css}</style>\n</head>\n<body>\n<div id=\"calendar\">${html}</div>\n<script>window.__WM_STATE__=${JSON.stringify(state).replace(/</g, '\\\\u003c')};window.__WM_READY__=true;</script>\n</body>\n</html>`;\n\nfs.writeFileSync(outputPath, page, 'utf8');",
"rationale": "Rendering an inline end-date picker with startDate, endDate, and openToDate set to the next month exercises the Day.isInSelectingRange path; the buggy revision applies --in-selecting-range across the next month, while the fixed revision does not.",
"repo": "Hacker0x01/react-datepicker",
"schema_version": "worldmodelmmbench.render-probe.v3",
"title": "End-date picker highlights next month after end date is selected",
"viewport": [
1280,
960
],
"volatile_fields": []
}