Skip to content

Instantly share code, notes, and snippets.

@Droogans
Created February 2, 2015 16:07
Show Gist options
  • Save Droogans/ef4ccca4c161942870d9 to your computer and use it in GitHub Desktop.
Save Droogans/ef4ccca4c161942870d9 to your computer and use it in GitHub Desktop.
A sample of what the rx-page-objects documentation looks like after it is generated.

#Index

Modules

Namespaces

#encore.rxSortableColumn Members

##encore.rxSortableColumn.initialize(rxSortableColumnElement, [repeaterString]) Params

  • rxSortableColumnElement WebElement - WebElement to be transformed into an rxSortableColumn object.
  • [repeaterString] String - Repeater string from the table. Required for data

Returns: Page - Page object representing the rxSortableColumn object.
##encore.rxSortableColumn.byTable(tableElement) Params

  • tableElement WebElement - Web element of the entire <table> node.

Returns: Page - rxSortableColumns Page object representing the rxSortableColumns object.
##const: encore.rxSortableColumn.sortDirections Returns: Object - sortDirections Lookup of integer codes for sort directions from human-readable ones.
Example

var sorts = encore.rxSortableColumn.sorts;
// ...
it('should sort the column ascending by default', function () {
    expect(column.currentSortDirection).to.eventually.equal(sorts.ascending);
});

#encore.rxStatusColumn Members

##encore.rxStatusColumn.initialize(rxStatusCellElement) Params

  • rxStatusCellElement WebElement - Status cell element from a table row.

Returns: Page - Page object representing an rxStatusColumn.
##const: encore.rxStatusColumn.statuses Returns: Object - Lookup of status strings from human-readable statuses.
##const: encore.rxStatusColumn.icons Returns: Object - Lookup of icon class names from a human-readable version.
##const: encore.rxStatusColumn.colors Returns: Object - Lookup of color class names from a human-readable class name.
#rxSortableColumn Members

##rxSortableColumn.sort Prefer using sortAscending and sortDescending over this.

##rxSortableColumn.data Returns: Array - A list of all cell text in this column.
##rxSortableColumn.getDataUsing Return a list of all cell contents in this column. Passes all cell elements to customFn, or if undefined, will return just the text of each cell. The second argument, allByCssSelectorString is used when your column's binding (which is used by by.repeater().column) is for some reason unreachable by protractor. A common reason why this wouldn't be the case is because the binding is not used as text within a web element, but instead used within the tag's attrs. An example of this is illustrated here: Binding inside of a tag's attributes. In these cases, you should specify a css selector that will select each element in the column you care about, since by.binding is not an option.

Params

  • [customFn] function - Specific work that must occur to all column cell elements.
  • [allByCssSelectorString] String - Fallback $$('.all-by-css')-style call to select column cells.

Returns: Array - Dependent on the return value of customFn.
Example

var sumCurrency = function (columnElements) {
    return columnElements.reduce(function (acc, columnElement) {
        return columnElement.getText().then(function (text) {
            return acc + encore.rxForm.currencyToPennies(text);
        });
    }, 0);
};

charges.column('Usage Charges').getDataUsing(sumCurrency).then(function (sum) {
    expect(currentUsage.estimate).to.eventually.equal(sum);
});

##rxSortableColumn.currentSortDirection The current sort direction of the column.

   - Ascending sort:  (1)  means the arrow is pointed down. [0-9, a-z]
   - Descending sort: (0)  means the arrow is pointed up.   [z-a, 9-0]
   - Not sorted:     (-1)  means there is no arrow for this column.

Returns: Integer - : 1, 0, or -1 based on direction. Use sortDirections when testing your columns.
##rxSortableColumn.sortAscending() Will repeatedly click the sort button until the column is sorted ascending.

Returns: undefined
##rxSortableColumn.sortDescending() Will repeatedly click the sort button until the column is sorted descending.

Returns: undefined
#rxSortableColumns Members

##rxSortableColumns.names Return all column names in tableElement. If any special work needs to be done, pass in a custom mapFn to getNamesUsing instead.

Returns: Array - : An array of strings representing text in each column in the table.
#rxStatusColumn Members

##rxStatusColumn.byType Represents the custom defined status type. This has no relation to the tooltip text, the icon chosen, or the color used to represent it.

Returns: String - Status cell's custom defined status type.
##rxStatusColumn.byIcon Represents the status as summarized by the icon selection alone. Extracted from the font-awesome icon used.

Returns: String - Status cell's font-awesome icon name.
##rxStatusColumn.byColor Represents the status as summarized by the color selection alone. Extracted from the class name.

Returns: String - Status cell's color class name.
##rxStatusColumn.tooltip Will appear on hover.

Members

###tooltip.exists Hovers over the current row's status column and returns whether or not a tooltip appears.

Returns: Boolean - Whether or not a tooltip is present.
###tooltip.text Returns: String - Tooltip text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment