Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
9b60f92
Move pages plug in from dash-labs
AnnMarieW Feb 24, 2022
4dbf472
Change how pages feature is enabled
AnnMarieW Feb 25, 2022
d304e67
tests
AnnMarieW Feb 25, 2022
2599921
new usage page - need to add a test
AnnMarieW Mar 7, 2022
4764c9c
fixed bug: page_registry can now be updated from a callback
AnnMarieW Mar 7, 2022
18655e7
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Mar 7, 2022
e95f6a9
changelog
AnnMarieW Mar 7, 2022
12c7bf7
update-1 after review
AnnMarieW Mar 18, 2022
63abbe4
Update dash/dash.py
AnnMarieW Mar 18, 2022
1f38e4f
Merge branch 'add-pages' of https://github.com/AnnMarieW/dash into ad…
AnnMarieW Mar 18, 2022
9ee5ac0
added check for dash.page_container
AnnMarieW Mar 19, 2022
5f790cf
move validate pathnames
AnnMarieW Mar 20, 2022
fdf72b4
refactored interpolate_index
AnnMarieW Mar 20, 2022
9802893
fix so pages_folder can be renamed
AnnMarieW Mar 21, 2022
9d622ac
update 2 after review
AnnMarieW Mar 22, 2022
135be02
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Mar 22, 2022
e459d21
fixed page_container
AnnMarieW Mar 24, 2022
a935a06
Re-run tests
AnnMarieW Mar 24, 2022
399caa5
fix tests
AnnMarieW Mar 24, 2022
fcfb61b
use pages_folder name rather than hard-coded "pages"
AnnMarieW Mar 29, 2022
0487158
added default layout with page_container
AnnMarieW Mar 30, 2022
370130b
fixed test
AnnMarieW Apr 1, 2022
ef6f57e
fixed lint
AnnMarieW Apr 1, 2022
fdf1a3d
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Apr 1, 2022
aceeb9b
added test,
AnnMarieW Apr 2, 2022
8c4adc6
oops
AnnMarieW Apr 2, 2022
3bc882a
update after alexj review
AnnMarieW Apr 6, 2022
f0f81aa
Update dash/dash.py
AnnMarieW Apr 6, 2022
d3f2600
Update dash/dash.py
AnnMarieW Apr 6, 2022
c4a0b23
Update dash/dash.py
AnnMarieW Apr 6, 2022
2780bb6
Merge branch 'add-pages' of https://github.com/AnnMarieW/dash into ad…
AnnMarieW Apr 6, 2022
492bc00
added test and lint
AnnMarieW Apr 6, 2022
8f5926c
removed self.page_registry
AnnMarieW Apr 6, 2022
a205e62
more updates after review
AnnMarieW Apr 7, 2022
0ce004e
added page["relative_path"]
AnnMarieW Apr 9, 2022
556b10e
improved template matcher
AnnMarieW Apr 13, 2022
b8834b3
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Apr 13, 2022
07f70ac
refactored template matcher
AnnMarieW Apr 16, 2022
5ef4d04
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Apr 16, 2022
d93bad8
fixed test
AnnMarieW Apr 16, 2022
2e05833
added get_server()
AnnMarieW Apr 16, 2022
58810e2
lint
AnnMarieW Apr 16, 2022
0b1cd14
rerun test and updated examples
AnnMarieW Apr 17, 2022
a58e96b
updated get_server and added test
AnnMarieW Apr 21, 2022
0bc1856
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Apr 21, 2022
053653b
temp commit
AnnMarieW Apr 22, 2022
bfbf307
temp commit and merge dev
AnnMarieW Apr 22, 2022
858e71f
lint and add tests
AnnMarieW Apr 23, 2022
5f669e9
added more error checking
AnnMarieW Apr 23, 2022
56d569b
fix tests
AnnMarieW Apr 23, 2022
09d6316
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Apr 23, 2022
bbc160a
small fix
AnnMarieW Apr 24, 2022
9eb975a
Add test component as prop.
T4rk1n Mar 11, 2022
3c91fd0
Add component as prop support
T4rk1n Mar 11, 2022
7f1f5eb
Add childrenProps to components json only if there is any.
T4rk1n Mar 14, 2022
be3fea4
Remove test component not children.
T4rk1n Mar 14, 2022
60367ec
Handle components in list.
T4rk1n Apr 14, 2022
253f03a
Add support for component in dictionaries props.
T4rk1n Apr 19, 2022
56bd57a
Lint fix.
T4rk1n Apr 21, 2022
e2cf8dc
Support components in list of dictionary.
T4rk1n Apr 25, 2022
cf7e6b3
Add checklist label support for components.
T4rk1n Apr 25, 2022
f8a2f3e
Add RadioItems label support for components.
T4rk1n Apr 25, 2022
dce32fd
Add dropdown label support for components.
T4rk1n Apr 25, 2022
f239b20
Allow app.layout to be callable. Update dash.get_server
AnnMarieW Apr 25, 2022
eb7293d
lint
AnnMarieW Apr 27, 2022
d4a4998
Merge branch 'dev' into component-as-props
T4rk1n Apr 29, 2022
6e0b8f3
Add collect node, store children_props on generated class, renderer h…
T4rk1n Apr 29, 2022
63f7312
Improve checks.
T4rk1n Apr 29, 2022
7b0d796
removed dash.get_server() added dash.get_app()
AnnMarieW Apr 30, 2022
fa1bc34
Exclude children from node collect, json childrenProps only if any.
T4rk1n May 2, 2022
7ea2ecb
Fix union rendering.
T4rk1n May 2, 2022
3a26a40
Fix render of union in arrayOf.
T4rk1n May 2, 2022
642fbea
Collect children props in component registry, serve in config.
T4rk1n May 2, 2022
854446c
Extract config to use in crawl layout.
T4rk1n May 2, 2022
8814d44
Merge branch 'dev' into component-as-props
T4rk1n May 3, 2022
62caf4e
Export renderer store.
T4rk1n May 3, 2022
d43e212
Cleanup/Proper handling of nodes.
T4rk1n May 4, 2022
c45f7ac
Store childrenProps on window.
T4rk1n May 5, 2022
1414f10
Update _callback_context.py
LiamConnors May 9, 2022
8b83f1f
Fix markdown mathjax in html.
nickmelnikov82 May 11, 2022
8799878
Fix import error when running pytest but dash[testing] not installed.
T4rk1n May 11, 2022
7793807
Update changelog.
T4rk1n May 11, 2022
5765097
fixe meta-tags
AnnMarieW May 11, 2022
aad1aac
Merge pull request #2046 from plotly/fix-import-error
alexcjohnson May 11, 2022
e774908
version number for 2.4.1
alexcjohnson May 11, 2022
b84fad8
Fixed bug that prevented env DASH_DEBUG to work
May 12, 2022
3e79e34
Add additional failing cases to test.
nickmelnikov82 May 12, 2022
c90f7dd
Merge branch 'dev' into fix-markdown-mathjax-in-html
nickmelnikov82 May 12, 2022
93a392a
Added changelog entry.
nickmelnikov82 May 12, 2022
cebad07
Merge pull request #2043 from nickmelnikov82/fix-markdown-mathjax-in-…
alexcjohnson May 12, 2022
16f81f4
Added wait_for_class_to_equal
May 13, 2022
d3d7360
Added wait_for_contains_class
May 13, 2022
2772bad
Add change to CHANGELOG.md
May 13, 2022
3c76d2a
Fixing Deprecation Messages
May 13, 2022
84d6ff5
Fix namespace props not resolving in ts components.
T4rk1n May 16, 2022
04b186f
Remove forced jsx option.
T4rk1n May 16, 2022
cddea6b
added exception if page_registry() in callback, added tests, update …
AnnMarieW May 17, 2022
42627ca
fixed test
AnnMarieW May 18, 2022
994df6e
Reimplemented default behaviour and added extra env check
May 18, 2022
b178e93
fixed another test
AnnMarieW May 18, 2022
3d6dfda
Added unit tests and fixed pylint error in dash.py
PGrawe May 18, 2022
15dcce2
Fixed linting error
PGrawe May 18, 2022
0ff0e94
Merge pull request #2051 from plotly/update-typo
alexcjohnson May 20, 2022
e803701
Merge branch 'dev' into fix-ts-namespaces
T4rk1n May 20, 2022
1e57fb2
Merge pull request #2053 from plotly/fix-ts-namespaces
T4rk1n May 20, 2022
0f04c19
Update tests/unit/test_configs.py
alexcjohnson May 20, 2022
12e6d97
Add changes from PR
MrTeale May 20, 2022
174ed71
Changes from PR and Changelog entry
MrTeale May 21, 2022
657c4b7
Merge branch 'plotly:dev' into debug_env
PGrawe May 21, 2022
3655c0f
Update CHANGELOG.md
PGrawe May 21, 2022
b59ac20
Merge pull request #2047 from PGrawe/debug_env
alexcjohnson May 21, 2022
f601775
Merge branch 'dev' into desired-capabilities-deprecation
alexcjohnson May 21, 2022
49fab85
Merge pull request #2050 from MrTeale/desired-capabilities-deprecation
alexcjohnson May 21, 2022
04217e8
Merge pull request #2049 from MrTeale/wait-for-class-values
alexcjohnson May 21, 2022
0c42b70
Fix Dropdown with a value but no options.
T4rk1n May 24, 2022
c2f046c
Update changelog.
T4rk1n May 24, 2022
34fd848
Merge pull request #2065 from plotly/fix-dropdown-2064
T4rk1n May 24, 2022
8e4b1cf
Get base nodes to return non nested components props only.
T4rk1n May 26, 2022
8d4edfc
Move bracket to end of children prop path.
T4rk1n May 26, 2022
9b92930
Merge branch 'dev' into component-as-props
T4rk1n May 27, 2022
463b4ba
Change labels prop type to node only.
T4rk1n May 27, 2022
30b4b86
Remove elements from test ComponentAsProp
T4rk1n May 27, 2022
cbcbf34
collapse table storybook tests into many fewer snapshots
alexcjohnson May 27, 2022
f222bfe
prune unnecessary percy snapshots in dash/renderer & dcc
alexcjohnson May 27, 2022
311ada9
Fix typescript compiler nested types.
T4rk1n May 30, 2022
4d869c2
review feedback - and convert all dcc test f-strings
alexcjohnson Jun 1, 2022
d78ec32
oops remove change I made while testing the tests
alexcjohnson Jun 1, 2022
d6369bd
Merge pull request #2069 from plotly/slim-percy
alexcjohnson Jun 1, 2022
e2a3363
Update dash/_configs.py
AnnMarieW Jun 1, 2022
b490523
delete usage folder
AnnMarieW Jun 1, 2022
ae47574
Merge branch 'dev' of https://github.com/plotly/dash into add-pages
AnnMarieW Jun 1, 2022
6044351
added test for no layout, minor refactoring of error messages and fun…
AnnMarieW Jun 1, 2022
0d78db6
Bump eventsource from 1.1.0 to 1.1.1 in /components/dash-table
dependabot[bot] Jun 1, 2022
c20399f
Move base node iteration to component generator.
T4rk1n Jun 2, 2022
f27bee8
Merge branch 'dev' into component-as-props
T4rk1n Jun 2, 2022
3761b80
Update changelog.
T4rk1n Jun 2, 2022
6e57b0b
Add back deleted test debc026
T4rk1n Jun 2, 2022
a9337d4
fixed tests
AnnMarieW Jun 2, 2022
ebc309a
Add test legacy components.
T4rk1n Jun 2, 2022
467d4ca
Merge pull request #1965 from plotly/component-as-props
T4rk1n Jun 2, 2022
21daba0
clean up after pages no layout test, instead of before other tests
alexcjohnson Jun 2, 2022
fde2323
Merge branch 'dev' into add-pages
alexcjohnson Jun 2, 2022
fbd3603
Merge pull request #1947 from AnnMarieW/add-pages
alexcjohnson Jun 2, 2022
08b5450
Merge pull request #2075 from plotly/dependabot/npm_and_yarn/componen…
alexcjohnson Jun 2, 2022
7ff6d4f
Merge branch 'dev' into fix-ts-nested
T4rk1n Jun 2, 2022
7cff937
Update changelog.
T4rk1n Jun 2, 2022
38562cb
noise
T4rk1n Jun 2, 2022
48bf177
Merge pull request #2070 from plotly/fix-ts-nested
T4rk1n Jun 2, 2022
1f090fe
Dash 2.5.0 version bumps
T4rk1n Jun 6, 2022
9f4480c
Merge pull request #2080 from plotly/version-update-2-5-0
T4rk1n Jun 6, 2022
93a936d
Merge branch 'dev' into master-2.5.0
T4rk1n Jun 6, 2022
7e2abc0
Dash renderer package-lock.json version bump to 2.5.0
T4rk1n Jun 7, 2022
756b246
Merge pull request #2082 from plotly/renderer-package-lock-version
T4rk1n Jun 7, 2022
4ba470a
Merge branch 'dev' into master-2.5.0
T4rk1n Jun 7, 2022
58e2a3f
Build artifacts for 2.5.0
T4rk1n Jun 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ function getMetadata() {
'""', // reserved keywords
path.join(__dirname, 'src', 'components')
],
// To debug `meta-ts.js` using pycharm debugger:
// comment `env` and add `MODULES_PATH=./node_modules`
// in the run config environment variables.
{
env: {MODULES_PATH: path.resolve(__dirname, './node_modules')},
env: {MODULES_PATH: path.resolve(__dirname, './node_modules'), ...process.env},
cwd: __dirname
}
);
Expand Down Expand Up @@ -218,6 +215,21 @@ describe('Test Typescript component metadata generation', () => {
});
}
);

test(
'Nested props to any', () => {
expect(
R.path([
'TypeScriptComponent',
'props',
'nested',
'type',
'value',
'nested',
'name'
], metadata)).toBe('any')
}
)
});

describe('Test component comments', () => {
Expand Down Expand Up @@ -245,4 +257,9 @@ describe('Test Typescript component metadata generation', () => {
expect(R.path(['StandardComponent'], metadata)).toBeDefined();
});
});
describe('Test namespace props', () => {
test('Component with picked boolean prop', () => {
expect(R.path(['WrappedHTML', "props", "autoFocus", "type", "name"], metadata)).toBe("bool");
})
})
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import {WrappedHTMLProps} from '../props';

/**
* Component docstring
*/
const WrappedHTML = (props: WrappedHTMLProps) => {
return null;
};

export default WrappedHTML;
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import TypeScriptComponent from './components/TypeScriptComponent';
import TypeScriptClassComponent from './components/TypeScriptClassComponent';
import MemoTypeScriptComponent from './components/MemoTypeScriptComponent';
import StandardComponent from './components/StandardComponent.react';
import WrappedHTML from './components/WrappedHTML';

export {
TypeScriptComponent,
TypeScriptClassComponent,
MemoTypeScriptComponent,
StandardComponent
StandardComponent,
WrappedHTML,
};
12 changes: 12 additions & 0 deletions @plotly/dash-generator-test-component-typescript/src/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Needs to export types if not in a d.ts file or if any import is present in the d.ts
import React from 'react';


type Nested = {
nested: Nested;
}

export type TypescriptComponentProps = {
children?: React.ReactNode;
id?: string;
Expand Down Expand Up @@ -35,4 +40,11 @@ export type TypescriptComponentProps = {
setProps?: (props: Record<string, any>) => void;
className?: string;
style?: any;

nested?: Nested;
};

export type WrappedHTMLProps = {
children?: React.ReactNode;
id?: string;
} & Pick<React.ButtonHTMLAttributes<any>, 'autoFocus'>
34 changes: 34 additions & 0 deletions @plotly/dash-test-components/src/components/ComponentAsProp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';


const ComponentAsProp = (props) => {
const { element, id, shapeEl, list_of_shapes } = props;
return (
<div id={id}>
{shapeEl && shapeEl.header}
{element}
{shapeEl && shapeEl.footer}
{list_of_shapes && <ul>{list_of_shapes.map(e => <li key={e.value}>{e.label}</li>)}</ul> }
</div>
)
}

ComponentAsProp.propTypes = {
id: PropTypes.string,
element: PropTypes.node,

shapeEl: PropTypes.shape({
header: PropTypes.node,
footer: PropTypes.node,
}),

list_of_shapes: PropTypes.arrayOf(
PropTypes.exact({
label: PropTypes.node,
value: PropTypes.number,
})
)
}

export default ComponentAsProp;
4 changes: 3 additions & 1 deletion @plotly/dash-test-components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MyPersistedComponent from './components/MyPersistedComponent';
import MyPersistedComponentNested from './components/MyPersistedComponentNested';
import StyledComponent from './components/StyledComponent';
import WidthComponent from './components/WidthComponent';
import ComponentAsProp from './components/ComponentAsProp';

export {
AsyncComponent,
Expand All @@ -15,5 +16,6 @@ export {
MyPersistedComponent,
MyPersistedComponentNested,
StyledComponent,
WidthComponent
WidthComponent,
ComponentAsProp,
};
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [2.5.0] - 2022-06-07

### Added

- [#1947](https://github.com/plotly/dash/pull/1947) Added `pages` - a better way to build multi-page apps. For more information see the [forum post.](https://community.plotly.com/t/introducing-dash-pages-a-dash-2-x-feature-preview/57775)
- [#1965](https://github.com/plotly/dash/pull/1965) Add component as props.
- [#2049](https://github.com/plotly/dash/pull/2043) Added `wait_for_class_to_equal` and `wait_for_contains_class` methods to `dash.testing`

### Changed

- [#2050](https://github.com/plotly/dash/pull/2050) Changed `find_element` and `find_elements` to accept an `attribute` argument that aligns with Selenium's `By` class, allowing you to search elements by other attributes. Default value is `CSS_SELECTOR` to maintain backwards compatibility with previous `find_elements`.

### Fixed

- [#2043](https://github.com/plotly/dash/pull/2043) Fix bug
[#2003](https://github.com/plotly/dash/issues/2003) in which
`dangerously_allow_html=True` + `mathjax=True` works in some cases, and in some cases not.
- [#2065](https://github.com/plotly/dash/pull/2065) Fix bug [#2064](https://github.com/plotly/dash/issues/2064) rendering of `dcc.Dropdown` with a value but no options.
- [#2047](https://github.com/plotly/dash/pull/2047) Fix bug [#1979](https://github.com/plotly/dash/issues/1979) in which `DASH_DEBUG` as environment variable gets ignored.
- [#2070](https://github.com/plotly/dash/pull/2070) Fix bug [#2066](https://github.com/plotly/dash/issues/2066) nested types triggering maximum call stack error when building typescript components.

## [2.4.1] - 2022-05-11

### Fixed

- Fix [#2045](https://github.com/plotly/dash/issues/2045) import error when using pytest but `dash[testing]` is not installed.

## [2.4.0] - 2022-05-11

### Added
Expand Down
4 changes: 2 additions & 2 deletions components/dash-core-components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/dash-core-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-core-components",
"version": "2.4.0",
"version": "2.5.0",
"description": "Core component suite for Dash",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ Checklist.propTypes = {
/**
* The option's label
*/
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.bool,
]).isRequired,
label: PropTypes.node.isRequired,

/**
* The value of the option. This value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ Dropdown.propTypes = {
/**
* The option's label
*/
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
.isRequired,
label: PropTypes.node.isRequired,

/**
* The value of the option. This value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ RadioItems.propTypes = {
/**
* The option's label
*/
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.bool,
]).isRequired,
label: PropTypes.node.isRequired,

/**
* The value of the option. This value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const Dropdown = props => {
);

useEffect(() => {
if (optionsCheck !== sanitizedOptions && !isNil(value)) {
if (
!isNil(sanitizedOptions) &&
optionsCheck !== sanitizedOptions &&
!isNil(value)
) {
const values = sanitizedOptions.map(option => option.value);
if (multi && Array.isArray(value)) {
const invalids = value.filter(v => !values.includes(v));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ export default class DashMarkdown extends Component {
)}
/>
),
dashMathjax: props => (
<Math tex={props.value} inline={props.inline} />
),
};

const regexMath = value => {
const newValue = value.replace(
/(\${1,2})((?:\\.|[^$])+)\1/g,
function (m, tag, src) {
const inline = tag.length === 1 || src.indexOf('\n') === -1;
return `<dashMathjax value='${src}' inline='${inline}'/>`;
}
);
return newValue;
};

return (
Expand Down Expand Up @@ -151,7 +165,11 @@ export default class DashMarkdown extends Component {
props.value
) : (
<JsxParser
jsx={props.value}
jsx={
mathjax
? regexMath(props.value)
: props.value
}
components={componentTransforms}
renderInWrapper={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def select_date_single(self, compid, index=0, day="", outside_month=False):
outside_month: used in conjunction with day. indicates if the day out
the scope of current month. default False.
"""
date = self.find_element("#{} input".format(compid))
date = self.find_element(f"#{compid} input")
date.click()

def is_month_valid(elem):
Expand Down Expand Up @@ -66,11 +66,8 @@ def select_date_range(self, compid, day_range, start_first=True):
)
return

date = self.find_element(
'#{} input[aria-label="{} Date"]'.format(
compid, "Start" if start_first else "End"
)
)
prefix = "Start" if start_first else "End"
date = self.find_element(f'#{compid} input[aria-label="{prefix} Date"]')
date.click()
for day in day_range:
self._wait_until_day_is_clickable()
Expand All @@ -85,8 +82,7 @@ def select_date_range(self, compid, day_range, start_first=True):

def get_date_range(self, compid):
return tuple(
_.get_attribute("value")
for _ in self.find_elements("#{} input".format(compid))
_.get_attribute("value") for _ in self.find_elements(f"#{compid} input")
)

def _wait_until_day_is_clickable(self, timeout=1):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_cdpr002_updatemodes(dash_dcc):
],
)
def update_output(start_date, end_date):
return "{} - {}".format(start_date, end_date)
return f"{start_date} - {end_date}"

dash_dcc.start_server(app=app)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
)
def test_dldf001_download_dataframe(fmt, dash_dcc):
df = pd.DataFrame({"a": [1, 2, 3, 4], "b": [2, 1, 5, 6], "c": ["x", "x", "y", "y"]})
reader = getattr(pd, "read_{}".format(fmt)) # e.g. read_csv
writer = getattr(df, "to_{}".format(fmt)) # e.g. to_csv
filename = "df.{}".format(fmt)
reader = getattr(pd, f"read_{fmt}") # e.g. read_csv
writer = getattr(df, f"to_{fmt}") # e.g. to_csv
filename = f"df.{fmt}"
# Create app.
app = Dash(__name__, prevent_initial_callbacks=True)
app.layout = html.Div(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@ def test_dddo002_array_comma_value(dash_dcc):
dash_dcc.wait_for_text_to_equal("#react-select-2--value-0", "San Francisco, CA\n ")

assert dash_dcc.get_logs() == []


def test_dddo003_value_no_options(dash_dcc):
app = Dash(__name__)

app.layout = html.Div(
[
dcc.Dropdown(value="foobar", id="dropdown"),
]
)

dash_dcc.start_server(app)
assert dash_dcc.get_logs() == []
dash_dcc.wait_for_element("#dropdown")
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_ddsv001_search_value(dash_duo):
Output("output", "children"), inputs=[Input("dropdown", "search_value")]
)
def update_output(search_value):
return 'search_value="{}"'.format(search_value)
return f'search_value="{search_value}"'

dash_duo.start_server(app)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def test_grrs001_graph(dash_dcc, responsive, autosize, height, width, is_respons
[
html.Div(
[
"responsive: {}, ".format(responsive),
"autosize: {}, ".format(autosize),
"height: {}, ".format(height),
"width: {}, ".format(width),
"is_responsive: {}".format(is_responsive),
f"responsive: {responsive}, ",
f"autosize: {autosize}, ",
f"height: {height}, ",
f"width: {width}, ",
f"is_responsive: {is_responsive}",
]
),
html.Div(id="card", style=card_style, children=[header, graph]),
Expand Down
Loading