-
-
Notifications
You must be signed in to change notification settings - Fork 195
support font icons #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
support font icons #380
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16409,3 +16409,4 @@ <h2>Icons</h2> | |
| </ul> | ||
| <p>This is a total of 2050 icons.</p> | ||
| {% endblock %} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16409,3 +16409,4 @@ <h2>Icons</h2> | |
| </ul> | ||
| <p>This is a total of 2050 icons.</p> | ||
| {% endblock %} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
flask_bootstrap/static/bootstrap4/css/font/bootstrap-icons.min.css
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file added
BIN
+127 KB
flask_bootstrap/static/bootstrap4/css/font/fonts/bootstrap-icons.woff2
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
flask_bootstrap/static/bootstrap5/css/font/bootstrap-icons.min.css
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file added
BIN
+127 KB
flask_bootstrap/static/bootstrap5/css/font/fonts/bootstrap-icons.woff2
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| from flask import render_template_string | ||
|
|
||
|
|
||
| def test_render_icon(app, client): | ||
| def test_render_icon_svg(app, client): | ||
| @app.route('/icon') | ||
| def icon(): | ||
| return render_template_string(''' | ||
|
|
@@ -78,7 +78,7 @@ def icon_desc_classes(): | |
| assert 'class="bi text-success bg-light"' in data | ||
|
|
||
|
|
||
| def test_render_icon_config(app, client): | ||
| def test_render_icon_svg_config(app, client): | ||
| app.config['BOOTSTRAP_ICON_SIZE'] = 100 | ||
| app.config['BOOTSTRAP_ICON_COLOR'] = 'success' | ||
|
|
||
|
|
@@ -94,3 +94,70 @@ def icon(): | |
| assert 'width="100"' in data | ||
| assert 'height="100"' in data | ||
| assert 'text-success' in data | ||
|
|
||
|
|
||
| def test_render_icon_font(app, client): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the test for the config |
||
| @app.route('/icon') | ||
| def icon(): | ||
| return render_template_string(''' | ||
| {% from 'bootstrap4/utils.html' import render_icon %} | ||
| {{ render_icon('heart', font=True) }} | ||
| ''') | ||
|
|
||
| @app.route('/icon-size') | ||
| def icon_size(): | ||
| return render_template_string(''' | ||
| {% from 'bootstrap4/utils.html' import render_icon %} | ||
| {{ render_icon('heart', 32, font=True) }} | ||
| ''') | ||
|
|
||
| @app.route('/icon-style') | ||
| def icon_style(): | ||
| return render_template_string(''' | ||
| {% from 'bootstrap4/utils.html' import render_icon %} | ||
| {{ render_icon('heart', color='primary', font=True) }} | ||
| ''') | ||
|
|
||
| @app.route('/icon-color') | ||
| def icon_color(): | ||
| return render_template_string(''' | ||
| {% from 'bootstrap4/utils.html' import render_icon %} | ||
| {{ render_icon('heart', color='green', font=True) }} | ||
| ''') | ||
|
|
||
| response = client.get('/icon') | ||
| data = response.get_data(as_text=True) | ||
| assert '<i class="bi-heart' in data | ||
| assert 'size: 1em;' in data | ||
|
|
||
| response = client.get('/icon-size') | ||
| data = response.get_data(as_text=True) | ||
| assert '<i class="bi-heart' in data | ||
| assert 'size: 32;' in data | ||
|
|
||
| response = client.get('/icon-style') | ||
| data = response.get_data(as_text=True) | ||
| assert '<i class="bi-heart' in data | ||
| assert ' text-primary' in data | ||
|
|
||
| response = client.get('/icon-color') | ||
| data = response.get_data(as_text=True) | ||
| assert '<i class="bi-heart' in data | ||
| assert 'color: green;' in data | ||
|
|
||
|
|
||
| def test_render_icon_font_config(app, client): | ||
| app.config['BOOTSTRAP_ICON_SIZE'] = 100 | ||
| app.config['BOOTSTRAP_ICON_COLOR'] = 'success' | ||
|
|
||
| @app.route('/icon') | ||
| def icon(): | ||
| return render_template_string(''' | ||
| {% from 'bootstrap4/utils.html' import render_icon %} | ||
| {{ render_icon('heart', font=True) }} | ||
| ''') | ||
|
|
||
| response = client.get('/icon') | ||
| data = response.get_data(as_text=True) | ||
| assert 'size: 100;' in data | ||
| assert 'text-success' in data | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.