This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
inventory items rank attribut #225
Merged
jkleinsc
merged 2 commits into
HospitalRun:master
from
turboMaCk:feature/inventory_items_rank
Dec 10, 2015
+63
−9
Merged
Changes from all commits
Commits
Show all changes
2 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 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Ember from 'ember'; | ||
import SelectValues from 'hospitalrun/utils/select-values'; | ||
import computed from 'ember-computed'; | ||
|
||
export default Ember.Component.extend({ | ||
label: 'Rank', | ||
rankOptions: [], | ||
prompt: ' ', | ||
class: 'col-sm-2 test-inv-rank', | ||
|
||
options: computed('rankOptions', function() { | ||
return SelectValues.selectValues(this.get('rankOptions')); | ||
}), | ||
|
||
init() { | ||
this._super(...arguments); | ||
|
||
// set available options | ||
this.set('rankOptions', Ember.A(['A', 'B', 'C'])); | ||
} | ||
}); |
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{em-select | ||
label=label | ||
property=property | ||
content=options | ||
class=class | ||
prompt=prompt | ||
}} |
This file contains 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 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 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 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 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
23 changes: 23 additions & 0 deletions
23
tests/integration/components/inventory/rank-select-test.js
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
moduleForComponent('inventory/rank-select', 'Integration | Component | inventory/rank select', { | ||
integration: true | ||
}); | ||
|
||
test('it renders correctly', function(assert) { | ||
this.set('value', null); | ||
|
||
this.render(hbs`{{inventory/rank-select | ||
property='value' | ||
prompt='n/a' | ||
}}`); | ||
|
||
// options | ||
const $options = this.$('option'); | ||
assert.equal($options.length, 4, 'Should render 4 options'); | ||
assert.equal($options[0].value, 'null', 'First option value is null (prompt)'); | ||
assert.equal($options[0].innerHTML.trim(), 'n/a', 'First option label is prompt'); | ||
assert.equal($options[1].value, 'A', 'Second option is "A"'); | ||
assert.equal($options[2].value, $options[2].innerHTML.trim(), 'Values are similar as labels'); | ||
}); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because of this options can not be overwrite. Also there is unfinished discussion with @stefanpenner
#225 (diff)
#225 (comment)