Example #1
0
function mapFromDom() {

    const completed = selector( '#completed' ).get( 0 ).checked;

    const options = {
        'completed': completed,
        'work_date': dom.html( '#work_date' ),
        'short_description': dom.html( '#short_description' ),
        'long_description': dom.html( '#long_description' )
    };

    return options;
}
Example #2
0
    xit( 'tests on input fields', function () {

        var i, r, s, x = dom.createElement( 'div', undefined, {
            id: 'domCreateTest'
        } );

        r = dom.createElement( 'input', "domCreateTest", {
            id: 'domThingNode',
            className: 'someClass',
            size: 30,
            name: 'domThingNode'
        } );

        r = dom.createElement( 'textarea', "domCreateTest", {
            id: 'textFieldTest',
            className: 'someClass',
            size: 30,
            name: 'textFieldTest'
        } );

        dom.html( r, 'hello world' );

        dom.setTextFieldCursorPosition( r, 5, 6 );
        i = dom.getTextFieldCursorPosition( r );

        expect( i ).toBe( 5 );
    } );
Example #3
0
    it( "create element test", function () {
        var r, x = dom.createElement( 'div', undefined, {
            id: 'domCreateTest'
        } );

        expect( x ).not.toBe( undefined );

        dom.html( '#domCreateTest', '' );
        expect( x.innerHTML ).toBe( '' );

        dom.html( '#domCreateTest', 'hello world' );
        expect( x.innerHTML ).toBe( 'hello world' );

        dom.toggleDisplay( 'domCreateTest' );
        expect( x.innerHTML ).toBe( 'hello world' );
    } );
Example #4
0
events.addOnLoad( () => {
    const myclock = new DigitalClock();
    myclock.setId( "digiclock" );
    myclock.startClock();

    const cal = new Calendar( "calendarContainer" );
    cal.render();

    dom.html( "#cautionContent", capabilities + detected );
    menu.basicMenu();
    footer( 'footer' );
} );
Example #5
0
    this.render = function () {
        var result, selectObjs, callback, _self, tds,
            yeadTD, p, content, x, yearTD,
            parentObj, po;

        // actual dom reference object
        po = selector( "#" + this.parentID );
        parentObj = po.get( 0 );
        if ( !parentObj ) {
            throw ( "Could not get parent element to attach calendar to!" );
        }

        // the calendar has not been rendered
        // this is like 'first time in' lol
        if ( !this.hasRendered ) {
            // reference to outself
            _self = this;

            // add click event
            callback = function ( evt ) {
                _self.handleClick( evt, _self );
            };
            events.addEvent( parentObj, 'click', callback, false );

            result = buildCalendarFrame( this.date );
            dom.html( po, result );

            // need to handle the select onchange event
            selectObjs = selector( "select", parentObj );
            selectObjs.get( 0 ).onchange = function ( evt ) {
                _self.handleClick( evt, _self );
            };
            this.handle.selection = selectObjs.get( 0 );

            // ok now we setup the handle to the year table data element
            tds = selector( "td", parentObj );
            yearTD = false;
            for ( p = 0; p < tds.length; p += 1 ) {
                if ( css.hasClass( tds.get( p ), "calyear" ) ) {
                    yearTD = tds.get( p );
                    break;
                }
            }
            this.handle.year = yearTD;

            // ok calendar has been rendered for the first time
            this.hasRendered = true;
        }
        this.handle.selection.selectedIndex = this.date.getMonth();

        dom.html( this.handle.year, this.date.getFullYear() );

        if ( !this.handle.content ) {
            // this will work for now, but should really get the class name
            content = selector( "#" + this.parentID + "content", parentObj );
            if ( !content ) {
                throw ( "Could not build calendar frame" );
            }
            this.handle.content = content.get( 0 );
        }

        // build the inner calendar
        var innerCal = '<table class="calendar">' + getHeaderRow() + getCalendarRows( this.date ) + '</table>';
        dom.html( this.handle.content, innerCal );
    };