ProWM-Bench / data /rs /probes /hacker0x01__react-datepicker-4652.json
simonlqy's picture
Initial release of ProWM-Bench v1.0.0 (part 2)
ea621d1 verified
Raw History Blame Contribute Delete
4.04 kB
{
"build_script": "build",
"build_workdir": ".",
"bundle_artifact": "",
"decision_relevant_fields": [
"adapter_state.previous_navigation_present",
"adapter_state.next_navigation_present"
],
"execution_mode": "browser",
"expected_page_errors": [],
"instance_id": "hacker0x01__react-datepicker-4652",
"payload": {},
"predicate_description": "The previous and next year navigation buttons are absent from the rendered quarter picker when minDate and maxDate both fall in the visible year.",
"predicate_js": "(s) =>\n s.adapter_state.previous_navigation_present === false &&\n s.adapter_state.next_navigation_present === false",
"product_output_kind": "interactive_visual",
"program_js": "const fs = require(\"fs\");\n\nconst input = JSON.parse(\n Buffer.from(process.argv[1], \"base64\").toString(\"utf8\")\n);\nconst outputPath = process.argv[2];\n\nconst React = require(\"/testbed/node_modules/react\");\nconst ReactDOMServer = require(\"/testbed/node_modules/react-dom/server\");\nconst DatePicker = require(\"/testbed/dist/index.js\").default;\n\nconst PROPS = {\n showQuarterYearPicker: true,\n minDate: new Date(\"2023-01-01T00:00:00\"),\n maxDate: new Date(\"2023-12-31T23:59:59\"),\n selected: new Date(\"2023-06-15\"),\n open: true,\n inline: true,\n};\n\nlet markup = \"\";\nlet error = null;\n\ntry {\n markup = ReactDOMServer.renderToStaticMarkup(\n React.createElement(DatePicker, PROPS)\n );\n} catch (e) {\n error = {\n name: String((e && e.name) || \"Error\"),\n message: String((e && e.message) || e),\n };\n}\n\nconst state = {\n render_ok: !error,\n error,\n previous_navigation_present: markup.includes(\n \"react-datepicker__navigation--previous\"\n ),\n next_navigation_present: markup.includes(\n \"react-datepicker__navigation--next\"\n ),\n previous_disabled: markup.includes(\n \"react-datepicker__navigation--previous--disabled\"\n ),\n next_disabled: markup.includes(\n \"react-datepicker__navigation--next--disabled\"\n ),\n year_header:\n (markup.match(/react-datepicker-year-header[^>]*>([^<]+)/) || [])[1] || \"\",\n quarter_count: (\n markup.match(/class=\"[^\"]*react-datepicker__quarter-text[^\"]*\"/g) || []\n ).length,\n};\n\nconst statusText =\n \"prev_arrow=\" +\n state.previous_navigation_present +\n \" next_arrow=\" +\n state.next_navigation_present +\n \" year=\" +\n state.year_header +\n \" quarters=\" +\n state.quarter_count;\n\nconst page =\n '<!doctype html>\\n' +\n \"<html>\\n\" +\n \"<head>\\n\" +\n '<meta charset=\"utf-8\">\\n' +\n \"<title>\" +\n String(input.title).replace(/[<>]/g, \"\") +\n \"</title>\\n\" +\n '<link rel=\"stylesheet\" href=\"lib.css\">\\n' +\n \"<style>\\n\" +\n \" body { font-family: \\\"Helvetica Neue\\\", helvetica, arial, sans-serif; padding: 2rem; background: #fff; }\\n\" +\n \" #app { display: inline-block; }\\n\" +\n \" #status { margin-top: 1rem; font-size: 0.85rem; color: #555; }\\n\" +\n \"</style>\\n\" +\n \"</head>\\n\" +\n \"<body>\\n\" +\n '<div id=\"app\">' +\n markup +\n \"</div>\\n\" +\n '<div id=\"status\">' +\n statusText +\n \"</div>\\n\" +\n \"<script>\\n\" +\n \"window.addEventListener('load', function () {\\n\" +\n \" window.__WM_STATE__ = \" +\n JSON.stringify(state) +\n \";\\n\" +\n \" window.__WM_READY__ = true;\\n\" +\n \"});\\n\" +\n \"</script>\\n\" +\n \"</body>\\n\" +\n \"</html>\";\n\nfs.writeFileSync(outputPath, page, \"utf8\");",
"rationale": "Renders the datepicker inline with showQuarterYearPicker and minDate/maxDate both in 2023; the buggy revision keeps the previous/next year arrows in the markup while the fixed revision removes them because no adjacent-year quarter is selectable.",
"repo": "Hacker0x01/react-datepicker",
"schema_version": "worldmodelmmbench.render-probe.v3",
"style_artifact": "dist/react-datepicker.min.css",
"title": "Quarter year picker arrow navigation with minDate/maxDate",
"viewport": [
1280,
960
],
"volatile_fields": []
}