Skip to content

Commit c87299b

Browse files
committed
Add showPercent to indicator response when explicitly set
1 parent 4106f13 commit c87299b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ooui/graph/indicator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def process(self, value, total=0):
6969
res['icon'] = self.icon.eval(res)
7070
if self.progressbar:
7171
res['progressbar'] = self.progressbar
72+
if self.show_percent:
73+
res['showPercent'] = self.show_percent
7274
if not self.show_percent and not self.progressbar:
7375
res.pop('percent', None)
7476
return res

spec/graph/graph_spec.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
result = graph.process(50, 100)
5353
expect(result).to(have_key('percent', 50.0))
5454
expect(result).to(have_key('progressbar', True))
55+
expect(result).not_to(have_key('showPercent'))
5556

5657
with it('should calculate percent when showPercent is true'):
5758
xml = """<?xml version="1.0"?>
@@ -60,6 +61,7 @@
6061
graph = parse_graph(xml)
6162
result = graph.process(50, 100)
6263
expect(result).to(have_key('percent', 50.0))
64+
expect(result).to(have_key('showPercent', True))
6365

6466
with it('should not include percent when both progressbar and showPercent are false'):
6567
xml = """<?xml version="1.0"?>
@@ -69,6 +71,7 @@
6971
result = graph.process(50, 100)
7072
expect(result).not_to(have_key('percent'))
7173
expect(result).not_to(have_key('progressbar'))
74+
expect(result).not_to(have_key('showPercent'))
7275

7376
with it("should parse a chart graph XML with type line"):
7477
xml = """<?xml version="1.0"?>

0 commit comments

Comments
 (0)