예제 #1
0
    public function testRenderJsContainerEventManager()
    {
        $map = new Map();
        $map->setJavascriptVariable('map');
        $baseEvent = new Event('instance', 'click', 'function(){}', false);
        $map->getEventManager()->addDomEvent($domEvent = clone $baseEvent);
        $domEvent->setJavascriptVariable('dom_event');
        $map->getEventManager()->addDomEventOnce($domEventOnce = clone $baseEvent);
        $domEventOnce->setJavascriptVariable('dom_event_once');
        $map->getEventManager()->addEvent($event = clone $baseEvent);
        $event->setJavascriptVariable('event');
        $map->getEventManager()->addEventOnce($eventOnce = clone $baseEvent);
        $eventOnce->setJavascriptVariable('event_once');
        $expected = <<<EOF
map_container.event_manager.dom_events.dom_event = dom_event = google.maps.event.addDomListener(instance, "click", function(){}, false);
map_container.event_manager.dom_events_once.dom_event_once = dom_event_once = google.maps.event.addDomListenerOnce(instance, "click", function(){}, false);
map_container.event_manager.events.event = event = google.maps.event.addListener(instance, "click", function(){});
map_container.event_manager.events_once.event_once = event_once = google.maps.event.addListenerOnce(instance, "click", function(){});

EOF;
        $this->assertSame($expected, $this->mapHelper->renderJsContainerEventManager($map));
    }